views:

135

answers:

1

Hi guys,

I am upgrading my application from vb6 to vb.net.

I used to populate my data in datalist control in vb6 forms. I am not finding it in vb.net windows form application. Which one control is the equivalent to it?

How can i list my data in that control?

just like: I had a table with data like id, name

I want the name should be the displayed column and id the bound column? how can i do that

+1  A: 

I'm not exactly sure but I think you're looking for a ListBox. You create a class with 2 members and a property for each (suggested property names ID and Name), create a list of them and put all your data in there and then just set the 'ListBox.DisplayMember' to "Name" and ListBox.ValueMember to "ID".

The MSDN page for ListControl.DisplayMember has a full sample showing how to do it as can be seen here.

Though I'd suggest that you use a List(Of YourClass) rather than the ArrayList in the sample.

ho1
that was agr8 one... well can it be even done with combo box control instead of listbox
KoolKabin
@KoolKabin: Sure, should work more or less exactly the same I think.
ho1