On Aug 9, 1:28 pm, "fniles" <fni...@pfmail.comwrote:
In VB6 in combobox you can use ItemData to assign a key to the combo box
item.
Like so:
With cboGroup
.AddItem "Database"
.ItemData(.newindex) = c_RefData
:
I understand in VB.NET there is no equivalent for ItemData. So, if I need to
assign a key to the combobox item, how can I do that ?
Thank you.
The VB.NET combobox is not limited to a strings with a Long value for
the .ItemData. You can store whole objects in the .net combobox:
public class TheDataItem
...
public property Name() as string
...
end property
public property Id () as integer
...
end property
...
end class
dim dataItem as new TheDataItem()
dataitem.name = "john"
dataitem.id = 123
combobox.displaymemeber = "Name"
combobox.items.add(dataitem)
HTH,
Tom Shelton