[RESOLVED] Combo Box - How to show drop down menu sans the Mouse.
My data is alphabetical and is all loaded into the ComboBox (Style-0) in Form Load.
I would like the drop down menu to appear as soon as the user starts to type in his/her entry. I'll use Keydown() but I can't figure out how to make the drop down menu appear without using the Mouse(usual way).
Any suggestions will be greatly appreciated.
Re: Combo Box - How to show drop down menu sans the Mouse.
Re: Combo Box - How to show drop down menu sans the Mouse.
Do you mean via code or keyboard?
Keyboard: F4
Via code: use SendKeys to send F4 to combobox when it has focus or search forum for CB_SHOWDROPDOWN
Re: Combo Box - How to show drop down menu sans the Mouse.
Quote:
can't figure out how to make the drop down menu appear without using the Mouse(usual way).
Is this what you want?
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
Const WM_KEYDOWN = &H100
Private Sub Combo1_GotFocus()
SendMessage Combo1.hwnd, WM_KEYDOWN, &H73, &H3E0001
End Sub
Re: Combo Box - How to show drop down menu sans the Mouse.
Quote:
Via code: use SendKeys to send F4 to combobox
I'd like to do it via code but I have been avoiding SendKeys since I've heard it might cause problems with Vista (I'm using XP to develop the program) but your solution should do the trick. I'll have to do some more research about using SendKeys in programs that will run on Vista and Win7.
Thanks for all repiles; I will try them all and see what works.
Re: Combo Box - How to show drop down menu sans the Mouse.
Quote:
Originally Posted by
Indio
I'd like to do it via code but I have been avoiding SendKeys since I've heard it might cause problems with Vista...
There are suitable API replacements for Vb's SendKeys: SendInput & keybd_event
Re: Combo Box - How to show drop down menu sans the Mouse.
Quote:
coolsid: Is this what you want?
Your API sure does the trick. Thanks very much.