• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

how to read the itemdata of a selected item in combo

I have entered a long as itemdata as I loaded the combo box. Now when the user selects an option in the combo i want to be able to read the corresponding value I loaded in the itemdata property.

I cannot find any info on this.

Can anyone help

Thanks

Merlin007

0
merlin007
Asked:
merlin007
1 Solution
 
GunsenCommented:
Combo1_Click()
MsgBox Combo1.ItemData (Combo1.ListIndex)
End Sub
0
 
ajexpertCommented:
This snippet will give selected Item Name with Item Data
    Dim Msg As String
    Msg = Combo1.ItemData(Combo1.ListIndex) & " "
    Msg = Combo1.List(Combo1.ListIndex)
    MsgBox Msg
0
 
ajexpertCommented:
Modify third line as
    Msg = Msg & Combo1.List(Combo1.ListIndex)
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
merlin007Author Commented:
Thanks

Merlin007
0
 
sudarshan_shirCommented:
Dim lListIndex as long
if combo.listINDEX <>-1 then
 lListIndex=combo.itemdata(combo.listindex)
end if
0
 
merlin007Author Commented:
sorry sudarshan shir, I had awarded the points before your answer came in. I am however using your code.

Thanks everyone
merlin007
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now