how can i manage my combo box to be automatically dropped down at run time (without click from the user)
Printable View
how can i manage my combo box to be automatically dropped down at run time (without click from the user)
Code: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 Command1_Click()
'show dropdown
Call SendMessage(Combo1.hWnd, CB_SHOWDROPDOWN, 1, 0)
End Sub
'''another way.
Code:'Drop down a combobox when it gains focus
Option Explicit
Dim bAlreadyDown As Boolean 'used to drop
Private Sub Form_Load()
'some insignificant data
Combo1.AddItem "List me 1"
Combo1.AddItem "List me 2"
End Sub
Private Sub Combo1_DropDown()
bAlreadyDown = True
End Sub
Private Sub Combo1_GotFocus()
If bAlreadyDown = False Then SendKeys ("{f4}")
bAlreadyDown = False
End Sub
Private Sub Combo1_LostFocus()
bAlreadyDown = False
End Sub