Solved

Advanced ComboBox select ...

Posted on 1998-08-21
7
158 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

808 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