I cant figure out how to save an xml file the right way. Say i want TextBox1 to save in node 1 and TextBox2 to save in node 2. So could someone please help.
This will create two attributes, Text1 and Text2 on the root node of your XML document. Of course, in real life you'll most likely want to have a separate node for each text box; that's very easy as well:
Using xtw As New Xml.XmlTextWriter("c:\tmp\test2.xml", System.Text.Encoding.UTF8)
Saving an XML
jptorres
paulfriday
Good news -- the XmlTextWriter (look for it in the online help or Google it) will help you do this in no time.
Of course, exact usage depends a lot on how you want to structure your XML. A simple example:
Using xtw As New Xml.XmlTextWriter("c:\tmp\test.xml", System.Text.Encoding.UTF8)End Using
This will create two attributes, Text1 and Text2 on the root node of your XML document. Of course, in real life you'll most likely want to have a separate node for each text box; that's very easy as well:
Using xtw As New Xml.XmlTextWriter("c:\tmp\test2.xml", System.Text.Encoding.UTF8)End Using
To read back your XML, there's the XmlTextReader, along with many other goodies in the XML namespace.
'//mdb