Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Binding a Collection to a ListBox Object
Message
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
00993867
Message ID:
00993871
Views:
24
Martin,
YES!!! <s> (that is the answer you wanted right?)
Yes you can bind a collection object to a listbox or combobox. You should be able to do this using the following code:
myListBox.DataSource = myCollectionObject;
You said that you had already tried that. What is displayed in the listbox when you set it's datasource to the collection object?
What should display in the listbox is whatever the collection object's objects ToString() method returns.

Let me know if that helps.

Einar

>A pleasant good morning to all!
>
>I have this collection object which will contain a structure variable (one created using the Public Stucture... End Sturcture syntax.
>
>I was just curious if it is possible to bind this simple collection object to a ListBox or any other object?
>
>If it is possible... how do I accomplish this?
>
>I've tried...
>
>LstBx.DataSource = MyCollObj
>LstBx.DisplayMember = "Name"
>LstBx.ValueMember = "ID"
>
>But this did not work. I also tried...
>
>LstBx.DataSource = MyCollObj.Items("Name")
>
>Which also was flop. I tried other stuff as well, which didn't work (that's why I'm making this post). And hoping that the answer I get is YES!!! and a tip, hint, or clue as to how this can be done.
>
>Many Thanx! in advance 8 )
>
>Martin
Semper ubi sub ubi.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform