Solved

how to read the itemdata of a selected item in combo

Posted on 2002-04-19
6
278 Views
Last Modified: 2010-05-02
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
Comment
Question by:merlin007
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 3

Expert Comment

by:Gunsen
ID: 6953206
Combo1_Click()
MsgBox Combo1.ItemData (Combo1.ListIndex)
End Sub
0
 
LVL 14

Accepted Solution

by:
ajexpert earned 100 total points
ID: 6953207
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
 
LVL 14

Expert Comment

by:ajexpert
ID: 6953213
Modify third line as
    Msg = Msg & Combo1.List(Combo1.ListIndex)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:merlin007
ID: 6953221
Thanks

Merlin007
0
 
LVL 1

Expert Comment

by:sudarshan_shir
ID: 6953223
Dim lListIndex as long
if combo.listINDEX <>-1 then
 lListIndex=combo.itemdata(combo.listindex)
end if
0
 

Author Comment

by:merlin007
ID: 6953255
sorry sudarshan shir, I had awarded the points before your answer came in. I am however using your code.

Thanks everyone
merlin007
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question