-
Dear VB users,
I am making a combobox with two types of information.
The first kind of information is a name, the second one is an ID to a database.
In priciple I don’t want to see the ID in the combobox. After selecting I want to see my name inclusive the ID number.
Can someone give me a solution??
Nice regards,
Michelle.
-
michelle, All you need is juz make use of the ComboBox's ItemData properties to store the ID.
Code:
Private Sub Combo1_Click()
MsgBox Combo1.Text & " --- " & Combo1.ItemData(Combo1.ListIndex)
End Sub
Private Sub Form_Load()
Dim n As Integer
With Combo1
For n = 0 To 10
.AddItem "Item " & n
.ItemData(n) = n
Next
End With
End Sub
-
Hello Chris,
Thanks you very much for your information.
Michelle.