Hi, welcome (again). 
Let me first explain my situation. I need to create a program that can easly move childnodes between parents. So I created 2 listboxes: one is filled with all childnodes and one is filled with all parents.
When a childnode and parent is selected the move button should move the selected childnode to his new parent (see picture attachment).
Well everything works now and the only thing I have to create still is the move action. Any suggestions what the best way is to create this? :afrog:
Code I have now currently (dosn't work):
XML:
Etc. etc. etc.
Thanks in advance,
Thista
Let me first explain my situation. I need to create a program that can easly move childnodes between parents. So I created 2 listboxes: one is filled with all childnodes and one is filled with all parents.
When a childnode and parent is selected the move button should move the selected childnode to his new parent (see picture attachment).
Well everything works now and the only thing I have to create still is the move action. Any suggestions what the best way is to create this? :afrog:
Code I have now currently (dosn't work):
VB.NET:
' Actions behind the Move button
Dim xmlDoc As New XmlDocument()
xmlDoc.Load(Filepath)
Dim SelectedNode As XmlNode = xmlDoc.DocumentElement
XmlCN = LBUtterance.SelectedItem.ToString
XmlPN = LBCategory.SelectedItem.ToString
Dim xmlRoot As XmlNode
MessageBox.Show(XmlPN + " + " + XmlCN)
For Each SelectedNode In xmlDoc.DocumentElement
If SelectedNode.Name = XmlPN AndAlso XmlCN <> "" Then
MessageBox.Show("test!")
xmlRoot = SelectedNode.Clone()
Dim XmlE As XmlElement = xmlDoc.CreateElement("utterance")
XmlE.InnerText = XmlCN
xmlRoot.AppendChild(xmlRoot)
xmlDoc.ReplaceChild(xmlRoot, SelectedNode)
xmlDoc.Save("C:\test.xml")
End If
Next
HTML:
<?xml version="1.0"?>
<labels>
<category name="afschrift">
<utterance>voor afschriften</utterance>
<utterance>afschrijvingsinformatie</utterance>
</category>
<category name="blabla">
<utterance>opvragen</utterance>
<utterance>bankafschriften</utterance>
</category>
</labels>
Thanks in advance,
Thista