Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding both text and an ID value to a VB6 combobox

Tags:

vb6

I am currently trying to add to my VB6 combobox using the AddItem method. This works, however, I want to display text in the drop down but I need to pass the ID of that text.

Is there a way to accomplish this by using the AddItem method?

like image 563
webdad3 Avatar asked Dec 27 '22 20:12

webdad3


1 Answers

It can't be done in the AddItem method but it's fairly easy to do it immediately after, using the NewIndex property, as long as the ID is a numeric value:

With Combo1
    For i = 16 To 34
        .AddItem "Item " & i
        .ItemData(.NewIndex) = i
    Next
End With
like image 75
Antagony Avatar answered Mar 05 '23 23:03

Antagony