I'm creating a bookmarks system for my web browser. I'm learning how to use XML files with VB.Net, so my bookmarks are stored in an XML file. When I want to add a new bookmark, the code below works, but it only allows for one bookmark. How can I append to the XML file instead of overwriting it?

'It's not bookmarked, so let's add it
            Dim wtrXML As New XmlTextWriter(My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\Test" & "\" & "Bookmarks.xml", System.Text.Encoding.UTF8)
            With wtrXML
                .Formatting = Formatting.Indented
                .WriteElementString("Name", browser.Title)
                .WriteElementString("URL", tbaddress.Text)
            End With

Thanks for your kind help,
JoThousand :)

Recommended Answers

All 2 Replies

Consider using something like an XmlDocument instead of using the writer directly. It'll be easier to do arbitrary things to your bookmark list with the XML DOM.

OK. Thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.