Populating ListBox with Attributes from XML

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello

I have attribute-based XML that I have put into a DataSet. Ultimately, I want to dynamically put items in the list box where DataMember equals an attribute in the XML

For example

<Data><Classmates><Classmate Name="Sam" ID="2" /><Classmate Name="Sue" ID="4"/></Classmates></Data

I want two items in the ListBox in this case: Sam and Sue

What is the best way to accomplish this

Thanks in advance

-Sarah
 
Create it as a dataset, walk through the rows and manually add the items and
subitems.

HTH,

Bill

www.devbuzz.com
www.knowdotnet.com

Sarah said:
Hello.

I have attribute-based XML that I have put into a DataSet. Ultimately, I
want to dynamically put items in the list box where DataMember equals an
attribute in the XML.
 
Then do the same thing binding to the displaymember and valuemember. If you
get them in a dataset, just use the column names
Sarah said:
Thanks, Bill.

I saw examples on the web about manually adding items to the ListBox
through Add(). However, through that way, there doesn't seem to be a way to
control the value of the item. I want to explicitly set the ValueMember so
that the value of the list item is the Classmate's ID attribute value.
 
Back
Top