0

Hi,

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
                .WriteStartDocument()
                .WriteStartElement("WebSites")
                .WriteStartElement("WebSite")
                .WriteElementString("Name", browser.Title)
                .WriteElementString("URL", tbaddress.Text)
                .WriteEndElement()
                .WriteEndElement()
                .WriteEndDocument()
                .Flush()
                .Close()
            End With

Thanks for your kind help,
JoThousand :)

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by JoThousand
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.