How to save XML file in windows programming??
I have two textboxes..Uname and Pwd
now when I click on login button it gives me XML string like..<XML?.............>
now how to store this XML in my windows project??
Do you know??
Thanks!!
Try This
StringWriter stringwriter = new StringWriter(); XmlTextWriter xmlTextWriter = new XmlTextWriter(stringwriter); xmlTextWriter.Formatting = Formatting.Indented; xmlTextWriter.WriteStartDocument(); xmlTextWriter.WriteStartElement("root"); xmlTextWriter.WriteStartElement("information"); xmlTextWriter.WriteElementString("User Name", "User Name"); xmlTextWriter.WriteElementString("Password", "txtpass.txt"); xmlTextWriter.WriteEndElement(); xmlTextWriter.WriteEndDocument(); XmlDocument docSave = new XmlDocument(); docSave.LoadXml(stringwriter.ToString()); //write the path where you want to save the Xml file docSave.Save(@"c:\Information.xml");
or
Refer
http://visualcsharptutorials.com/net-framework/writing-xml-file
© COPYRIGHT 2024 ASPSnippets.com ALL RIGHTS RESERVED.