Skip to content

Instantly share code, notes, and snippets.

@mrowles
Created May 10, 2012 03:12
Show Gist options
  • Save mrowles/2650810 to your computer and use it in GitHub Desktop.
Save mrowles/2650810 to your computer and use it in GitHub Desktop.
Convert C# Form Data to XML File
Protected Sub FormToXML (ByVal sender As Object, ByVal e As System.EventArgs)
// Create the XML document object with specified parametres
Dim XMLDoc As XDocument
XMLDoc = New XDocument(
New XDeclaration("1.0", "utf-8", "yes"),
New XElement("user",
New XElement("details",
New XElement("firstname", Firstname.Text),
New XElement("surname", Lastname.Text)
)
)
)
// Save test file
XMLDoc.Save("C:\test.xml")
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment