Solved

Advanced ComboBox select ...

Posted on 1998-08-21
7
162 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
[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
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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.
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…

689 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