Visual Studio VB.Net to edit a column in XML

  • Thread starter Thread starter Moshe Simon Singer
  • Start date Start date
M

Moshe Simon Singer

Guest
I Exported a Table to XML which has 2 columns, ID#, Search_By

I want to be able to search column ID# =105

and programatically change the data in the Search_By column

how can i do it in the flowing sample



Dim MyXML As New XmlDocument()
MyXML.Load(Application.StartupPath & "MyXML.xml")
Dim MyXMLNode As XmlNode = MyXML.SelectSingleNode("Idnumber")
'If we have the node let's change the text
If MyXMLNode IsNot Nothing Then
Dim MyXMLNodes As XmlNodeList
MyXMLNodes = MyXMLNode.ChildNodes(0).ChildNodes
'Set the nodes text
If MyXMLNodes IsNot Nothing Then
MyXMLNodes.Item(0).InnerText = "NEW NODES TEXT"
End If
'Save the XML now
MyXML.Save(Application.StartupPath & "MyXML.xml")
End If

Thanks in Advence

Continue reading...
 
Back
Top