DataList Control in vb.net windows application forms
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开发者_如何学JAVA?
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
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.
精彩评论