• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 177
  • Last Modified:

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?
0
schworak
Asked:
schworak
1 Solution
 
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

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now