I want to be able to remove elements and parent node from my xml file by typing in or selecting the node id eg."SDB0000012E" somewhere in my form design rather than having to edit my code each time I want to delete elements. at the moment I have a check box which works perfectly fine however as I said I want to be able to type or select the node id in my form design. Is this even possible ? any help is appreciated.
If CheckBox2.Checked Then
Dim doc As New XmlDocument()
doc.Load(path & "data.xml")
Dim node As XmlNode = doc.SelectSingleNode("data_xml/DataTable/REFNO[. = 'SDB0000012E']")
If node IsNot Nothing Then
node.ParentNode.ParentNode.RemoveChild(node.ParentNode)
doc.Save(path & "data.xml")
End If
End If
Aucun commentaire:
Enregistrer un commentaire