Making a combo box drop down via code.

Is there an API or other code that will cause the STANDARD VB6 combo box drop down?

I have a control that is to be linked to a combo box (drop down). When the control gets focus, I want the combo box it is to be software linked to to drop down so the user can see the list of options and click on if he/she wishes.

Know of code to cause the drop down to happen on command?
LVL 3
schworakAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

vettrangerCommented:
Without researching how to make a combobox act like this ...

Is there any reason not to use a listbox instead.

You can change the listbox visible property to true and false to hide and show the list at appropriate times, or alternatively you could change the height property to make the listbox "drop down".

Or do you expressly need the selection to appear as a combo box?
0
Erick37Commented:
API solution:

Private Const CB_SHOWDROPDOWN = &H14F
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
   (ByVal hwnd As Long, ByVal wMsg As Long, _
   ByVal wParam As Long, lParam As Any) As Long


Private Sub Command1_Click()
    'Show the dropdown
    SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, True, 0
End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.