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

Re: Populating ListBox with Attributes from XML by William

William
Mon May 10 14:35:19 CDT 2004

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" <anonymous@discussions.microsoft.com> wrote in message
news:1592D126-F0EF-4921-87FE-6ABD1A544C32@microsoft.com...
> 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



Re: Populating ListBox with Attributes from XML by William

William
Mon May 10 15:43:40 CDT 2004

Then do the same thing binding to the displaymember and valuemember. If you
get them in a dataset, just use the column names
"Sarah" <anonymous@discussions.microsoft.com> wrote in message
news:5E8ECC95-AB6D-40ED-97B0-0C7998D99AA9@microsoft.com...
> 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.
>
> What is the simplest way to do that?
>
> Thanks.
>
> -Sarah