EDN Admin
Well-known member
I need help with reading an XML element into a textbox I have working ButtonSave_Click to an xml file and need help with the buttonRead_click.
<pre class="prettyprint lang-vb Imports System
Imports System.Xml
Public Class FormSettings
Private Sub ButtonSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSave.Click
Dim settings As New XmlWriterSettings()
settings.Indent = True
Initialize the Xmlwriter.
Dim xmlwrt As XmlWriter = XmlWriter.Create("Settings.xml", settings)
With xmlwrt
Write the Xml declaration.
.WriteStartDocument()
Write a comment.
.WriteComment("XML Database.")
Write the root element.
.WriteStartElement("Settings")
Start our first report.
.WriteStartElement("ApplicationSettings1")
The settings nodes.
.WriteStartElement("Settings1")
.WriteString(TextBoxSettings1.Text.ToString())
.WriteEndElement()
.WriteStartElement("Settings2")
.WriteString(TextBoxSettings2.Text.ToString())
.WriteEndElement()
.WriteStartElement("Settings3")
.WriteString(TextBoxSettings3.Text.ToString())
.WriteEndElement()
The end of this settings.
.WriteEndElement()
The end of this settings.
.WriteEndElement()
Close the XmlTextwriter.
.WriteEndDocument()
.Close()
MsgBox("Settings Saved successfully!", vbInformation, "Settings")
End With
End Sub
Private Sub ButtonRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRead.Click
End Sub
End Class[/code]
<pre class="prettyprint <?xml version="1.0" encoding="utf-8"?>
<!--XML Database.-->
<Settings>
<ApplicationSettings1>
<Settings1>1</Settings1>
<Settings2>1</Settings2>
<Settings3>1</Settings3>
</ApplicationSettings1>
</Settings>[/code]
<br/>
<br/>
<br/>
View the full article
<pre class="prettyprint lang-vb Imports System
Imports System.Xml
Public Class FormSettings
Private Sub ButtonSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonSave.Click
Dim settings As New XmlWriterSettings()
settings.Indent = True
Initialize the Xmlwriter.
Dim xmlwrt As XmlWriter = XmlWriter.Create("Settings.xml", settings)
With xmlwrt
Write the Xml declaration.
.WriteStartDocument()
Write a comment.
.WriteComment("XML Database.")
Write the root element.
.WriteStartElement("Settings")
Start our first report.
.WriteStartElement("ApplicationSettings1")
The settings nodes.
.WriteStartElement("Settings1")
.WriteString(TextBoxSettings1.Text.ToString())
.WriteEndElement()
.WriteStartElement("Settings2")
.WriteString(TextBoxSettings2.Text.ToString())
.WriteEndElement()
.WriteStartElement("Settings3")
.WriteString(TextBoxSettings3.Text.ToString())
.WriteEndElement()
The end of this settings.
.WriteEndElement()
The end of this settings.
.WriteEndElement()
Close the XmlTextwriter.
.WriteEndDocument()
.Close()
MsgBox("Settings Saved successfully!", vbInformation, "Settings")
End With
End Sub
Private Sub ButtonRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonRead.Click
End Sub
End Class[/code]
<pre class="prettyprint <?xml version="1.0" encoding="utf-8"?>
<!--XML Database.-->
<Settings>
<ApplicationSettings1>
<Settings1>1</Settings1>
<Settings2>1</Settings2>
<Settings3>1</Settings3>
</ApplicationSettings1>
</Settings>[/code]
<br/>
<br/>
<br/>
View the full article