Breaking News
Loading...
Monday, 10 December 2012

Add new node(Element) in existing xml file in C#.Net

first make form like :




-  now double click on button and write code like :

/////////////////////////   CODE    ////////////////////////////


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Xml;
using System.Windows.Forms;

namespace Xml_File_Operation
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
         private void button3_Click(object sender, EventArgs e)
        {

           
               XmlDocument xdoc1 = new XmlDocument();
                xdoc1.Load("C:\\Users\\Nirav\\Desktop\\people1.xml");
                XmlNode person = xdoc1.CreateElement("person");
                XmlNode name = xdoc1.CreateElement("name");
                name.InnerText = textBox1.Text;
                person.AppendChild(name);

                XmlNode age = xdoc1.CreateElement("age");
                age.InnerText = numericUpDown1.Value.ToString();
                person.AppendChild(age);

                XmlNode email= xdoc1.CreateElement("email");
                email.InnerText = textBox3.Text;
                person.AppendChild(email);

                xdoc1.DocumentElement.AppendChild(person);
                xdoc1.Save("C:\\Users\\Nirav\\Desktop\\people1.xml");

            }

      }
}


//////////////////         OUTPUT      ////////////////////////



it make chanch like :


                  




--
/\/ir@\/  <(.'.)>

74 comments:

  1. Nice Block It is very helpful.... Thanks a lot for your help...

    ReplyDelete
  2. Your blog is loaded with informative post on .Net technology. Thanks for sharing. DOT NET Course in Chennai

    ReplyDelete
  3. very helpful thanks for sharing... :)

    ReplyDelete
  4. i created a page to add nodes and saving on sql server in one button.But the nodes and added lokk like this ...(nodes are added at straight)..why?
    plese sugggest any solutions?

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. This comment has been removed by a blog administrator.

    ReplyDelete
  8. This comment has been removed by a blog administrator.

    ReplyDelete
  9. This comment has been removed by a blog administrator.

    ReplyDelete
  10. This comment has been removed by a blog administrator.

    ReplyDelete
  11. This comment has been removed by a blog administrator.

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. This comment has been removed by a blog administrator.

    ReplyDelete
  14. This comment has been removed by a blog administrator.

    ReplyDelete
  15. I have a problem. Visual Studio showed me this : "An unhandled exception of type 'System.IO.FileNotFoundException' occurred in System.Xml.dll

    Additional information: Cannot find file'C:\Users\Administrator\Desktop\test.xml'.

    ReplyDelete
    Replies
    1. Hello,
      First you have to make XML file and then save it to desktop with test.xml name and then run program

      Delete
  16. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete
  17. This article is very much helpful and I hope this will be a useful information for the needed one. Keep on updating these kinds of informative things...
    Selenium Training in Chennai

    ReplyDelete

  18. It is amazing and wonderful to visit your site.Thanks for sharing this information,this is useful to me...
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete

  19. I wish to show thanks to you just for bailing me out of this particular trouble.As a result of checking through the net and meeting techniques that were not productive, I thought my life was done.
    Advanced Selenium Training in Chennai

    ReplyDelete
  20. Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.

    Best Java Training Institute Chennai

    ReplyDelete
  21. Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition
    Best RPA Training in Bangalore


    Best RPA Training in Chennai

    ReplyDelete
  22. Existing without the answers to the difficulties you’ve sorted out through this guide is a critical case, as well as the kind which could have badly affected my entire career if I had not discovered your website.
    google-cloud-platform-training-in-chennai


    ReplyDelete
  23. Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.
    Best Java Training Institute Chennai
    Java Training Institute Bangalore

    ReplyDelete
  24. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.

    Best RPA Training in Chennai
    Best RPA Training in Bangalore

    ReplyDelete
  25. Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.
    amazon-web-services-training-in-bangalore

    ReplyDelete
  26. Thank you a lot for providing individuals with a very spectacular possibility to read critical reviews from this site.


    Best Java Training Institute Chennai

    Amazon Web Services Training in Chennai


    ReplyDelete
  27. This comment has been removed by the author.

    ReplyDelete
  28. Appreciation for really being thoughtful and also for deciding on certain marvelous guides most people really want to be aware of.
    Best selenium training Institute in chennai

    ReplyDelete
  29. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.

    Best Java Training Institute Chennai


    Amazon Web Services Training in Chennai


    ReplyDelete
  30. Thanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area.

    RPA Training in Bangalore

    ReplyDelete
  31. Ciitnoida provides Core and java training institute in

    noida
    . We have a team of experienced Java professionals who help our students learn Java with the help of Live Base Projects. The object-

    oriented, java training in noida , class-based build

    of Java has made it one of most popular programming languages and the demand of professionals with certification in Advance Java training is at an

    all-time high not just in India but foreign countries too.

    By helping our students understand the fundamentals and Advance concepts of Java, we prepare them for a successful programming career. With over 13

    years of sound experience, we have successfully trained hundreds of students in Noida and have been able to turn ourselves into an institute for best

    Java training in Noida.

    java training institute in noida
    java training in noida
    best java training institute in noida
    java coaching in noida
    java institute in noida

    ReplyDelete
  32. Those guidelines additionally worked to become a good way to recognize that other people online have the identical fervor like mine to grasp great deal more around this condition.
    datascience training in chennai

    ReplyDelete
  33. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    Best selenium training Institute in chennai

    ReplyDelete
  34. Excellent Article!
    Thanks for sharing that wonderful useful information,given contecn was very excellent and easily observe all provided information.

    Final Year Bsc Projects Chennai | Final Year BTech Projects in Chennai.

    ReplyDelete
  35. Your new valuable key points imply much a person like me and extremely more to my office workers. With thanks; from every one of us.
    AWS Online Training

    ReplyDelete
  36. The young boys ended up stimulated to read through them and now have unquestionably been having fun with these things.
    Hadoop Training in Bangalore
    Hadoop Training in Chennai

    ReplyDelete
  37. I prefer to study this kind of material. Nicely written information in this post, the quality of content is fine and the conclusion is lovely. Things are very open and intensely clear explanation of issues
    Click here:
    Microsoft azure training in tambaram
    Click here:
    Microsoft azure training in chennai

    ReplyDelete
  38. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    Devops Training in pune

    Devops Training in Chennai

    Devops Training in Bangalore

    AWS Training in chennai

    AWS Training in bangalore

    ReplyDelete
  39. Thanks for the good words! Really appreciated. Great post. I’ve been commenting a lot on a few blogs recently, but I hadn’t thought about my approach until you brought it up. 

    Blueprism training in annanagar

    Blueprism training in velachery

    Blueprism training in marathahalli


    AWS Training in chennai

    AWS Training in bangalore

    ReplyDelete
  40. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.
    Devops Training in pune|Devops training in tambaram|Devops training in velachery|Devops training in annanagar

    ReplyDelete
  41. Your good knowledge and kindness in playing with all the pieces were very useful. I don’t know what I would have done if I had not encountered such a step like this.

    rpa training in Chennai | rpa training in pune

    rpa training in tambaram | rpa training in sholinganallur

    rpa training in Chennai | rpa training in velachery

    rpa online training | rpa training in bangalore

    ReplyDelete
  42. Impressive. Your story always bring hope and new energy. Keep up the good work.
    python training in tambaram
    python training in annanagar
    python training in OMR

    ReplyDelete
  43. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
    Devops training in tambaram|Devops training in velachery|Devops training in annanagar|Devops training in sholinganallur

    ReplyDelete
  44. Wow it is really wonderful and awesome thus it is very much useful for me to understand many concepts and helped me a lot. it is really explainable very well and i got more information from your blog.

    rpa training in Chennai | rpa training in pune

    rpa training in tambaram | rpa training in sholinganallur

    rpa training in Chennai | rpa training in velachery

    rpa online training | rpa training in bangalore

    ReplyDelete
  45. Very good brief and this post helped me alot. Say thank you I searching for your facts. Thanks for sharing with us!
    java training in chennai | java training in USA

    selenium training in chennai


    ReplyDelete
  46. Thank you for benefiting from time to focus on this kind of, I feel firmly about it and also really like comprehending far more with this particular subject matter. In case doable, when you get know-how, is it possible to thoughts modernizing your site together with far more details? It’s extremely useful to me.
    Data Science course in kalyan nagar | Data Science course in OMR
    Data Science course in chennai | Data science course in velachery
    Data science online course | Data science course in jaya nagar

    ReplyDelete
  47. Your new valuable key points imply much a person like me and extremely more to my office workers. With thanks; from every one of us.
    safety course in chennai

    ReplyDelete
  48. I simply wanted to write down a quick word to say thanks to you for those wonderful tips and hints you are showing on this site.
    java training in chennai | java training in bangalore

    java interview questions and answers | core java interview questions and answers

    ReplyDelete
  49. This is an awesome post.Really very informative and creative contents. These concept is a good way to enhance the knowledge.I like it and help me to development very well.Thank you for this brief explanation and very nice information.Well, got a good knowledge.
    Data Science course in Chennai | Data science course in bangalore
    Data science course in pune | Data science online course
    Data Science Interview questions and answers | Python course in Kalyan nagar

    ReplyDelete
  50. You got an extremely helpful website I actually have been here reading for regarding an hour. I’m an initiate and your success is incredibly a lot of a concept on behalf of me.
    angularjs Training in btm

    angularjs Training in electronic-city

    angularjs online Training

    angularjs Training in marathahalli

    angularjs interview questions and answers

    ReplyDelete
  51. I’m bookmarking and will be tweeting this to my followers! Wonderful blog and amazing design and style.
    safety course in chennai

    ReplyDelete
  52. Howdy, would you mind letting me know which web host you’re utilizing? I’ve loaded your blog in 3 completely different web browsers, and I must say this blog loads a lot quicker than most. Can you suggest a good internet hosting provider at a reasonable price?


    Best AWS Training Institute in BTM Layout Bangalore ,AWS Coursesin BTM


    Best AWS Training in Marathahalli | AWS Training in Marathahalli

    Amazon Web Services Training in Jaya Nagar | Best AWS Training in Jaya Nagar


    AWS Training in BTM Layout |Best AWS Training in BTM Layout

    AWS Training in Marathahalli | Best AWS Training in Marathahalli

    ReplyDelete
  53. Thanks for making me this article. You have done a great job by sharing this content in here. Keep writing article like this.

    React Training
    React Training in Chennai

    ReplyDelete
  54. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.

    AWS Training in Bangalore | Amazon Web Services Training in bangalore , india

    AWS Training in pune | Amazon Web Services Training in Pune, india

    ReplyDelete
  55. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.

    Selenium Interview Questions and Answers

    Best Selenium Training in Chennai | Selenium Training Institute in Chennai | Besant Technologies

    Selenium Training in Bangalore | Best Selenium Training in Bangalore

    Free Selenium Tutorial |Selenium Webdriver Tutorial |For Beginners

    ReplyDelete
  56. emails with the same comment. Is there any way you can remove people from that service? Thanks.
    nebosh course in chennai

    ReplyDelete

Thanks for comment

 
Toggle Footer