.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> XML >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Add Single Tag Value at Runtime in XML File

Posted By:Narayanan       Posted Date: December 13, 2012    Points: 40    Category: XML    URL: http://www.dotnetspark.com  

Here , I give a Code for Add Single Tag value at Run time in XML File
 

This is a Method for Add Single Tag Value at Run Time in XML File.
 private void ChangeValueofXMLNodeValue(string XMLPath,string SelectedSingleTag)

        {

            XmlDocument doc = new XmlDocument();

            doc.Load(XMLPath);

            XmlNode root = doc.DocumentElement;

            XmlNode myNode = root.SelectSingleNode(SelectedSingleTag);

            myNode.InnerText= textBox1.Text ;

            doc.Save(XMLPath);

        }

ChangeValueofXMLNodeValue(XMLFileName,TagName)

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend