Thursday, July 9, 2009

How to Update value in xml file from C# form?

there is a file settings.Xml with Tag %26lt;language%26gt;%26lt;/language%26gt; under %26lt;settings%26gt;.. %26lt;application_settings%26gt;.Now i want to Update the value of %26lt;language%26gt; tag through a form Login.CS. tell me how can i do that?

How to Update value in xml file from C# form?
- Add a using System.Xml directive up at the top of your code behind file.


- Load the XML data into an XmlDocument object


- Use SelectSingleNode to grab the node in question, and assign it to an XmlNode object


- Assign the form value to the InnerText property of the XmlNode.


- Save the XmlDocument object (using the Save method) out to the location you want the file saved to (overwrite the old, or whatever.)





http://samples.gotdotnet.com/quickstart/...


No comments:

Post a Comment