Question : edit ad add to xml fie

Hi, I am using vb.net and looking hopefully for a simpler function that i can use to update my plain xml file.

How would i search for a specific element [DistribID] and then update the value and save?


thanks


 
    ELNumDaysionName>
    1e>
 

 
    DistribIDionName>
    CPClue>
 

Answer : edit ad add to xml fie

Try this:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
        Dim doc As New XmlDocument()
        doc.Load("C:\test.xml")

        Dim node As XmlNode = doc.CreateNode(XmlNodeType.Element, "", "ConfigValues", "")

        '// Create a new OptionName node
        Dim child As XmlNode = doc.CreateNode(XmlNodeType.Element, "", "OptionName", "")
        child.InnerText = "New Option"
        node.AppendChild(child)

        '// Create a new OptionValue node
        child = doc.CreateNode(XmlNodeType.Element, "", "OptionValue", "")
        child.InnerText = "New Value"
        node.AppendChild(child)

        '// Append to the main document
        doc.DocumentElement.AppendChild(node)

        doc.Save("C:\test.xml")
Random Solutions  
 
programming4us programming4us