0

Hi All,

Say I have two list box listBox1 and listBox2... i have some data loaded in listBox1 which is taken from XML file listBox1Data.xml... and for ex it contains A,B,C,D etc... and listBox2 i need to load data from another XML file which contains data like for A->a,b,c etc.. B->b,c,d.. etc.. it means if user selects A from listBox1 it needs to load all the subelements of main element 'A' from the listBox2.xml... can any one pls help in accompalising this in C#?

Thanks,
Pradeep

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Diamonddrake
0

Take a look at the dataset class. It has load/save xml methods that will automatically create a datatable containing the data in your XML document.

you can then use standard databinding if you are they type to use it, or you could navigate the datatable and select all the rows(sub elements) of each column(top elements) and add them to the listbox.

0

Here is a partial example of the concept, this isn't too advanced so you'll probably get a lot out of the experience of figuring it out. In this example I load the data from 1 XML file, and populate listbox 1 with toplevel xml as tables and listbox 2 with child elements of each as columns, the xml is loaded from the textbox on the form.

Give it a shot and adapt it to your purpose. Good luck.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.