I need to populate a combobox directly without a datasourceand still be able to use a display value and a real value.Code:items.add()
How can be done?
thank you
Printable View
I need to populate a combobox directly without a datasourceand still be able to use a display value and a real value.Code:items.add()
How can be done?
thank you
Have a read through this :)
http://www.vbforums.com/showthread.p...light=itemdata
You could create a structure like this:
VB.NET Code:
Private Structure MyStructure Private displayValue As String Private realValue As Integer Public Sub New(ByVal DisplayVal As String, ByVal RealVal As Integer) displayValue = DisplayVal realValue = RealVal End Sub Public Overrides Function ToString() As String Return displayValue End Function End Structure
Create a structure and add it to a combobox and you'll find that the structure has been added to the items collection but only the "DisplayValue" member is displayed, due to overriding the ToString function.
Check out this link... http://www.vbforums.com/showthread.php?t=533341
got it
thanks all