I have the code below testing and XML file to see if the userid is "0000". If so I want to replace the value "0000" with one submitted. I cant figure it out. I know (or think I do ) that I need a xmltextwriter but I cant get it to work.
The file im using has this in it. I want to replcae the "0000"'s with another number like"6872"
Thanks
Dan
Code:
Private Sub xml_read()
Dim userid As String
Dim writer As XmlTextWriter = Nothing
Dim asm As [Assembly] = [Assembly].GetExecutingAssembly()
Dim appPath As String = System.IO.Path.GetDirectoryName(asm.GetName().CodeBase)
Dim reader As XmlTextReader = Nothing
Try
reader = New XmlTextReader(appPath & "\userid.xml")
While reader.Read()
If reader.Name = "stuid" Then
reader.Read()
userid = (reader.ReadString())
If userid = "0000" Then
' ** enter new value here
End If
End If
End While
Me.TextBox1.Text = userid
Finally
If Not (reader Is Nothing) Then
reader.Close()
End If
End Try
End Sub
The file im using has this in it. I want to replcae the "0000"'s with another number like"6872"
Code:
<?xml version="1.0" encoding="utf-8" ?>
<student>
<stuid>0000</stuid>
<dteassgd>2005-08-24</dteassgd>
</student>
Thanks
Dan