Fetch XML file data in C#

Dec 1 2009 1:51 AM
Hi Guys
I am very new in DOTNET....

See this below code,
everything is going gud but in textbox1 I am not able to print..............
here I am working for only one node that is (EmpId) which is going to be print in textbox1. But I want 1 by 1 only.

  
 
private void FetchXML()
        {
            XmlDocument xmldoc = new XmlDocument();
            xmldoc.Load(xmlpath);
            XmlElement root = xmldoc.DocumentElement;
            XmlNode node = root.SelectSingleNode("
EmployeeID");
            XmlNodeList nodelist = node.SelectNodes("EmpId");
            foreach (XmlElement elment in nodelist)
            {
                string str = elment.InnerText;
//Not able to print EMPID one by one in textBox1

                textBox1.Text = str;  ---->  Problem with this line only to get data(What will be the code here to get data which is in str).

                //MessageBox.Show(str);----------------->    if we print in Message box then its working properly .........

           }

        }


        private void btnFetch_Click(object sender, EventArgs e)
        {
            FetchXML();
        }

Answers (1)