The code below is state from a project I got.
What it does is it allows you to easily set the data into variables then into the .xml file.
I dont know if is the answer you are looking for as this was written in 3.5 not 2.0
Public xmlsettingslocation As String = Application.StartupPath & "\Settings.xml"
#Region "Region_XMLSettings"
odule xmlSettings
Public ReadX1 As String = Nothing : Public ReadX2 As Boolean = Nothing
Public ReadX3 As String = Nothing : Public ReadX4 As String = Nothing
Sub xmlread()
MessageBox.Show(xmlsettingslocation)
If File.Exists(xmlsettingslocation) = False Then Else WriteX1 = "1" : WriteX2 = "True" : WriteX3 = "True" : WriteX4 = "String1" : xmlwrite()
Dim fs As FileStream = Nothing : fs = New FileStream(Settings.xmlsettingslocation, FileMode.Open, FileAccess.Read)
Dim xsdoc As New XmlDataDocument() : xsdoc.Load(fs)
Dim xsnode As XmlNodeList = Nothing : xsnode = xsdoc.GetElementsByTagName("Settings")
Dim ReadX1 As String = Nothing : ReadX1 = xsnode(0).ChildNodes.Item(0).InnerText.Trim()
Dim ReadX2 As String = Nothing : ReadX2 = xsnode(0).ChildNodes.Item(1).InnerText.Trim()
Dim ReadX3 As String = Nothing : ReadX3 = xsnode(0).ChildNodes.Item(2).InnerText.Trim()
Dim ReadX4 As String = Nothing : ReadX4 = xsnode(0).ChildNodes.Item(3).InnerText.Trim()
fs.Close()
End Sub
Public WriteX1 As Integer = CInt(0) : Public WriteX2 As Boolean = Nothing
Public WriteX3 As Boolean = Nothing : Public WriteX4 As String = Nothing
Private Sub createNode(ByVal pID As String, ByVal pN1 As String, ByVal pN2 As String, ByVal pN3 As String, ByVal writer As XmlTextWriter)
writer.WriteStartElement("Settings")
writer.WriteStartElement("ID")
writer.WriteString(pID) : writer.WriteEndElement()
writer.WriteStartElement("On_Exit_Close_Excel")
writer.WriteString(pN1) : writer.WriteEndElement()
writer.WriteStartElement("Screen_Updates")
writer.WriteString(pN2) : writer.WriteEndElement()
writer.WriteStartElement("Update_Path")
writer.WriteString(pN3) : writer.WriteEndElement()
writer.WriteEndElement()
End Sub
Sub xmlwrite()
Dim writer As New XmlTextWriter(xmlsettingslocation, Nothing)
writer.WriteStartDocument(True) : writer.Formatting = Formatting.Indented
writer.Indentation = 7
writer.WriteStartElement("Table")
createNode(CStr(WriteX1), CStr(WriteX2), CStr(WriteX3), CStr(WriteX4), writer)
WriteX1 = CInt(0) : WriteX2 = Nothing : WriteX3 = Nothing : WriteX3 = Nothing : WriteX4 = Nothing
writer.WriteEndElement() : writer.WriteEndDocument() : writer.Close()
End Sub
End Module
#End Region 'Region_XMLSettings
Public Class Form_Settings
Sub test()
Call xmlread()
WriteX1 = "1" : WriteX2 = "True" : WriteX3 = "string1" : WriteX4 = "string2" : xmlwrite()
WriteX3 = "Hello World!" : xmlwrite()
MessageBox.Show("your String Is: " & ReadX3)
End Sub
End Sub
I think you can Read and Write data into your database so you should be able to String1 = WriteX2 : xmlread() or somthing.