Private Sub btnMakeXML_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMakeXML.Click
REM Make the XML document
REM Gather the fileName and declare the variables
Dim fileName As String
Dim myFile As XmlTextWriter
Me.SaveFileDialog.ShowDialog()
fileName = Me.SaveFileDialog.FileName
myFile = New XmlTextWriter(fileName, Nothing)
With myFile
.Indentation = 4
.IndentChar = " "
.Formatting = .Indentation
.WriteStartDocument()
.WriteComment("This Is A test of my program")
.WriteStartElement("MyData")
.WriteElementString("User Name", Me.txtFileName.Text)
.WriteElementString("Data One", Me.txtData1.Text)
.WriteElementString("Data Two", Me.txtData2.Text)
.WriteEndElement() 'For The Data
.WriteEndDocument()
End With
myFile.Flush()
myFile.Close()
End Sub