Advanced ComboBox select ...

In the advanced combobox (the one where you can set more then one column), how can I select an item where the second column equals a specific item?
I fill the combobox with the following items:
"Test1", "1"
"Test2", "2"
"Test3", "3"
I want to select the item where the 2 second column has the value 3.
LVL 1
ndbAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
viktornetConnect With a Mentor Commented:
Ok, you got it woking ;-)

Regards,
Viktor Ivanov
0
 
blwatkinsCommented:
I can tell you how, but let me know what control you are using, I remember doing it, but I can't find the control I did it with.


0
 
ndbAuthor Commented:
It's the ComboBox that is delivered with Microsoft Forms 2.0 (fm20.dll).
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
viktornetCommented:
Are there any properties like Items or stuff like that???

In Delphi we use something like this

for i := 0 to Combo.Items.Count - 1 do
begin
  if Combo.items.Strings[i] = '3' then
    Combo.itemIndex := i;
end;

Hope this helps a bit....I don't know what properties your combo uses, otherwise I would have translated this code to VB...If you cam tell me what similar properties does your combo uses I might be able to help you.. =)

Regards,
Viktor Ivanov
0
 
ndbAuthor Commented:
It uses list and listindex ...
0
 
ndbAuthor Commented:
Your answer works. This is the code:

    For i = 0 To ComboBox1.ListCount - 1
        If ComboBox1.List(i, 1) = Text1.Text Then
            ComboBox1.ListIndex = i
        End If
    Next i

0
 
viktornetCommented:
I'm glad it worked :)

Regards,
Viktor Ivanov
0
All Courses

From novice to tech pro — start learning today.