I am looking for a sample of saving form data to a file with a custom extension or xml file. Is there a built in method to save all data in a form and reload it later or do you have to write a routine to save all the data one by one to a file?
I think it's the best when you use XML for this. If you want to write it to your file, you just load it, create the right node, and add the text you want to.
And reading from the file is the same, load your xml-file, navigate to the right node, and ask the innerText porperty, that will give you the text of that node.
Does this help?
I need to save out data from text boxes on a simple form. Basically just to provide a way for users to save and load data during different sessions of using the app. I am a vb newbie, so any advice would be appreciated. I would like to save the data in xml format, but am curious of making data files with my own extension too.
Oké, I think this discussion is getting a bit ridiculous and is not answering the guys question. If you want to write data, you can indeed chose for a text file or for an XML file. But if you have to read it, I think it will be much easier to read it from a XML file than from a text file. And it’s not that difficult to make it, you don’t need an xslt file, you can make the format right with VB.
An example will clear everything
So, you already made your xml file with the declaration and the root element. Then you just have to
Dim moDoc as new xmlDocument
Dim oXmlPart As XmlElement
oXmlPart = moDoc.CreateElement("part")
Dim oElement As XmlElement
oElement = moDoc.CreateElement("text")
oElement.InnerText() = txtChapterPart.Text
oElement = moDoc.CreateElement("sound")
oElement.InnerText() = txtSound.Text
Dim oXmlChapter As XmlElement
oXmlChapter = moDoc.SelectSingleNode("//chapter")
And if you want to read you xml file is even easier