Vous êtes sur la page 1sur 1

Automatically opening the dropdown of a combobox when

focus is receive
thread222-1666955
Forum

FAQs

Links

MVPs

CruiseMan (Programmer)
(OP)
16 Nov 11 13:46

Can anyone tell me a way to have a Type 2 combobox (VB6) open it's dropdown list when the control
receives focus (instead of having the user click the down arrow of the control to open it).
Thanks!

HughLerwill (Programmer)16 Nov 11 14:04


Private Sub Combo1_GotFocus()
Sendkeys "{F4}",True
End Sub
Generally works well, do it again and the combo dropdown lifts.
Alernatively;
http://msdn.microsoft.com/en-us/library/windows/desktop/bb775919(v=vs.85).aspx
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 Const CB_SHOWDROPDOWN = &H14F
Private Sub Combo1_GotFocus()
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, True, ByVal 0
End Sub

Vous aimerez peut-être aussi