Hello Guys,
I have following code:
My goal is to set the viewtimes in the XML file 1 higher.
When i monitor the viewnode var, it gets updated with 1 more, but when i look at the actual xml file, its not updated.
Any error in my code?
The xml file looks like this:
I have following code:
VB.NET:
Private Sub SetViewHigher(ByVal XMLFile As String)
Dim XMLDoc As New XmlDocument
XMLDoc.Load(XMLFile)
Dim viewtimes As XmlNodeList = XMLDoc.GetElementsByTagName("Viewtimes")
If viewtimes.Count = 0 Then
Else
Dim viewtimer As Integer = viewtimes.Item(0).InnerText
viewtimer = viewtimer + 1
Dim XMLDom As New XmlDocument()
XMLDom.Load(XMLFile)
Dim Viewnode As XmlNode = XMLDoc.SelectSingleNode("/Movie/Viewtimes")
Viewnode.InnerText = viewtimer.ToString
XMLDom.Save(XMLFile)
End If
End Sub
My goal is to set the viewtimes in the XML file 1 higher.
When i monitor the viewnode var, it gets updated with 1 more, but when i look at the actual xml file, its not updated.
Any error in my code?
The xml file looks like this:
VB.NET:
<?xml version="1.0" ?>
<!-- Movie: C:\Temp\MC\vorst1
-->
<Movie>
<Description>None</Description>
<PersonalComments>None</PersonalComments>
<Viewtimes>10</Viewtimes>
</Movie>