Solved

Advanced ComboBox select ...

Posted on 1998-08-21
7
154 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now