Hi,
The combobox will take objects rather than just strings as it's items.
I tend to make a custom class I call it dataitem and give it a string property and a data property. You then can override the ToString to return your String value:
Class DataItem
Private _Data as object
Private _Text as string
Public Property Data as object
Get()
Return _Data
End Get
Set (byVal value as object)
_Data = value
End Set
End Property
Public Property Text
Get()
Return _Text
End Get
Set (byVal value as string)
_Text = value
End Set
End Property
Public Overrides Function ToString() As String
Return _Text
End Function
Sub New (Optional byVal Data as Object = nothing, Optional ByVal Text as String ="")
_Text = Text
_Data = Data
End Sub
End Class
Now you can add your combobox items like this:
MyComboxbox.items.add( new DataItem(1,"Male"))
MyComboxbox.items.add( new DataItem(2, "Female"))
Then when you want to read the value:
dim DI as DataItem
dim MySex as integer
DI = MyCombobox.SelectedItem
MySex = cint(DI.Data)