in above xml file i want to retrieve only the column1 values in listbox. could someone please tell me how to do it , i m new to C#
How to save a xml file into listbox in C#
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.


VulpesRank #55 · 29.2K reputationPosted Oct 9, 2014, 4:54 AM EDT
// ...
listBox1.DataSource = names;
Abhishek KumarRank #510 · 4.8K reputationPosted Oct 9, 2014, 7:15 AM EDT
Please try this Code below
DataSet ds = new DataSet();
ds.ReadXml(@"D:\My Development\TestWeb\TestWeb\Test.xml");
ListBox1.DataValueField = "Column1" ;
ListBox1.DataTextField = "Column1";
ListBox1.DataSource = ds;
ListBox1.DataBind();
this is your xml i havenamed as Test.xml.
Hope this will help.
Abhishek
raju patil52 reputationPosted Oct 9, 2014, 8:50 PM EDT
raju patil52 reputationPosted Oct 9, 2014, 8:51 PM EDT