How can I make a ComboBox open in a gotfocus event?
I want the list to be displayed programaticly as if the down arrow was clicked.
I am almost sure I used to do this but I can't remember what it was that I did.
Any help is appreciated.
Printable View
How can I make a ComboBox open in a gotfocus event?
I want the list to be displayed programaticly as if the down arrow was clicked.
I am almost sure I used to do this but I can't remember what it was that I did.
Any help is appreciated.
I never did understand why the ComboBox control does not have a simple method to dropdown its own list.
Anyways, use the SendMessage API
Code:'In a Module
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const CB_SHOWDROPDOWN = &H14F
'Form
Private Sub Combo1_GotFocus()
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, 1, 0
End Sub
Thanks, it works great. Apparently I didn't use to do this.
Perhaps you used
Code:Private Sub Combo1_GotFocus()
SendKeys "{f4}"
End Sub
I don't recall it being the SendKeys command.