Using vb.net (vs2005), how do I populate a combo box with multiple property values from an object? Right now I'm iterating a collection of objects and adding the name property of each object to the combo box. I'd like to add multiple properties from the object to the list. For now, I'd be happy if they appeared comma separated in the list.
+1
A:
Private _items As New List(Of Person) 'you will need to fill this with data!'
Private Sub Populate()
For i As Integer = 0 To _items.count - 1
lst.items.add(_items(i).Name & ", " & _items(i).Age)
Next
End Sub
This will populate your listbox (which i have called lst) something like this:
Dave, 18
John, 21
Morgan, 23
Jen, 19
Pondidum
2009-04-30 19:13:27
+1
A:
If this is a winforms environment, override the ToStirng() method, and simply add the whole object to the items collection.
Rowland Shaw
2009-04-30 19:14:21
A:
You can either override the method by yourself.
Or you are lazy like me.
Try this multi column combo box
http://demos.telerik.com/aspnet-ajax/combobox/examples/functionality/multicolumncombo/defaultcs.aspx
RocketsLee
2009-05-01 16:26:06