Helpful Information
 
 
Category: Visual Basic Programming
Open Combo Box and DatePicker on focus event

I am developing a package and client want to open the combo box to be opened on 'setfocus' event or when cursor is focused on combo or DatePicker.


Please help me as soon as possible


Wioth regards
Vikas AThavale

Send the control a CB_SHOWDROPDOWN message using SendMessage and set wParam = 1 to drop the list (wParam = 0 will close the list), something like this:


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
Const CB_SHOWDROPDOWN = 335

Private Sub Combo1_GotFocus()
Call SendMessage(Combo1.hWnd, CB_SHOWDROPDOWN, 1, 0)
End Sub


Hope this helps!










privacy (GDPR)