Following is an example which describes more about the XML file in VB.net .
[vbnet]Imports System.Xml
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Set the caption bar text of the form.
Me.Text = "SPLessons.com"
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim xws As XmlWriterSettings = New XmlWriterSettings()
xws.Indent = True
xws.NewLineOnAttributes = True
Dim xw As XmlWriter = XmlWriter.Create("authors.xml", xws)
xw.WriteStartDocument()
xw.WriteStartElement("Authors")
xw.WriteStartElement("author")
xw.WriteAttributeString("code", "1")
xw.WriteElementString("fname", "Zara")
xw.WriteElementString("lname", "Ali")
xw.WriteEndElement()
xw.WriteStartElement("author")
xw.WriteAttributeString("code", "2")
xw.WriteElementString("fname", "Priya")
xw.WriteElementString("lname", "Sharma")
xw.WriteEndElement()
xw.WriteStartElement("author")
xw.WriteAttributeString("code", "3")
xw.WriteElementString("fname", "Anshuman")
xw.WriteElementString("lname", "Mohan")
xw.WriteEndElement()
xw.WriteStartElement("author")
xw.WriteAttributeString("code", "4")
xw.WriteElementString("fname", "Bibhuti")
xw.WriteElementString("lname", "Banerjee")
xw.WriteEndElement()
xw.WriteStartElement("author")
xw.WriteAttributeString("code", "5")
xw.WriteElementString("fname", "Riyan")
xw.WriteElementString("lname", "Sengupta")
xw.WriteEndElement()
xw.WriteEndElement()
xw.WriteEndDocument()
xw.Flush()
xw.Close()
WebBrowser1.Url = New Uri(AppDomain.CurrentDomain.BaseDirectory + "authors.xml")
End Sub
End Class[/vbnet]
Output
When compile the code following is the form will be displayed.
When user click on the button following is the result will be displayed.