?
Solved

how to read the itemdata of a selected item in combo

Posted on 2002-04-19
6
Medium Priority
?
279 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 400 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
Technology Partners: 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month14 days, 16 hours left to enroll

771 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