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
Solved

Advanced ComboBox select ...

Posted on 1998-08-21
7
159 Views
Last Modified: 2010-04-30
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.
0
Comment
Question by:ndb
  • 3
  • 3
7 Comments
 
LVL 1

Expert Comment

by:blwatkins
ID: 1430237
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
 
LVL 1

Author Comment

by:ndb
ID: 1430238
It's the ComboBox that is delivered with Microsoft Forms 2.0 (fm20.dll).
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1430239
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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 
LVL 1

Author Comment

by:ndb
ID: 1430240
It uses list and listindex ...
0
 
LVL 1

Author Comment

by:ndb
ID: 1430241
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
 
LVL 10

Expert Comment

by:viktornet
ID: 1430242
I'm glad it worked :)

Regards,
Viktor Ivanov
0
 
LVL 10

Accepted Solution

by:
viktornet earned 100 total points
ID: 1430243
Ok, you got it woking ;-)

Regards,
Viktor Ivanov
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…

861 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