PDA

Click to See Complete Forum and Search --> : How can i add hidden column in vbcombo


vetti
Jul 29th, 2000, 01:21 AM
Hello VB Gurus,
how can i add one or more hidden columns in
VB ComboBox.I would like to refer thier value in run time.
Is any API function ???

thanks for replying

vetti..

Aaron Young
Jul 29th, 2000, 09:48 AM
You could use an External Array to keep as many Extra hidden columns as you want, just use the Combo's ItemData as the link storing the Array Index (then you can sort the list without causing a problem), i.e.Private sExCombo() As String

Private Sub Form_Load()
Dim lIndex As Long

For lIndex = 0 To 9
Combo1.AddItem "Item " & lIndex + 1
ReDim Preserve sExCombo(Combo1.ListCount - 1)
sExCombo(Combo1.ListCount - 1) = "Extra Value " & lIndex + 1
Combo1.ItemData(Combo1.NewIndex) = lIndex
Next
Combo1.ListIndex = 0
End Sub

Private Sub Combo1_Click()
Caption = sExCombo(Combo1.ItemData(Combo1.ListIndex))
End Sub