I am using a combobox with 8 items in it.
How do I know which item the user has selected, i.e.,
combo1.listindex is 0 even tho the user has already
select something.
Thanks for the help.
Printable View
I am using a combobox with 8 items in it.
How do I know which item the user has selected, i.e.,
combo1.listindex is 0 even tho the user has already
select something.
Thanks for the help.
combo1.text
Private Sub Combo1_Click()
Label1.Caption = Combo1.Text
End Sub
Private Sub Form_Load()
Combo1.AddItem "One", 0
Combo1.AddItem "Two", 1
Combo1.AddItem "Three", 2
Combo1.AddItem "Four", 3
Combo1.AddItem "Five", 4
Combo1.AddItem "Six", 5
Combo1.AddItem "Seven", 6
Combo1.Text = "One"
End Sub
Hi Cander,
Sorry for not being clear. What I really want is the
index of the combo item and not the text because
I have another object that I must match the index
of the combo box to.
Example:
cboItems(0).text = "APPLE" cboPrice(0).text = "$1.4"
cboItems(1).text = "PEAR" cboPrice(1).text = "$1.0"
cboItems(2).text = "PIE" cboPrice(2).text = "$0.4"
So when the user selected "PEAR" I want to read
the value from cboPrice(1).text
oh..my bad..:p
found the answer/problem:
Answer: use the cboItems_click()
cboItems.ListIndex
Problem: cboItems_Change()
will return -1 for cboItems.ListIndex