Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

Can a combobox's entries be saved in a .xml file

$
0
0

I have searched and searched for days but for the life of me I can not find information on saving the contents/entries of a combobox to a .xml file. I am using vb.net 2010 framework 4. on Windows XP SP3. I need to learn how to loop through the combobox and then save all the entries probably no more the 20 to my .xml file. I also need of course, to retrieve the information and put it back into the combo box. I would like to use xmlwriter and xmlreader since I started with them. I really need to see an example and as much information available of how it works. Thank you in advance.

        If IO.File.Exists(VarXml.ToString + ".xml") = False Then
            Dim settings As New XmlWriterSettings()
            settings.Indent = True

            Dim XmlWrt As XmlWriter = XmlWriter.Create(VarXml.ToString, settings)

            With XmlWrt

                .WriteStartDocument()
                .WriteComment("ADES Database.")
                .WriteStartElement("Data")
                .WriteStartElement("Person")
 
                .WriteStartElement("ClientName")
                .WriteString(ClientName.ToString)
                .WriteEndElement()

                .WriteStartElement("EvaluationDate")
                .WriteString(StartDate.ToString)
                .WriteEndElement()

                .WriteStartElement("FirstName")
                .WriteString(Fname.ToString)
                .WriteEndElement()

                .WriteStartElement("MiddleName")
                .WriteString(Mname.ToString)
                .WriteEndElement()

                .WriteStartElement("LastName")
                .WriteString(Lname.ToString)
                .WriteEndElement()
                .WriteEndElement()
                .WriteEndDocument()
                .Close()

            End With

 

Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>