|
-
Sep 1st, 2010, 01:26 PM
#1
Thread Starter
Junior Member
[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.
-
Sep 1st, 2010, 01:38 PM
#2
Hyperactive Member
Re: Combo Box - How to show drop down menu sans the Mouse.
-
Sep 1st, 2010, 01:56 PM
#3
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
-
Sep 1st, 2010, 02:45 PM
#4
Re: Combo Box - How to show drop down menu sans the Mouse.
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
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Sep 1st, 2010, 03:08 PM
#5
Thread Starter
Junior Member
Re: Combo Box - How to show drop down menu sans the Mouse.
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.
-
Sep 1st, 2010, 03:19 PM
#6
Re: Combo Box - How to show drop down menu sans the Mouse.
 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
-
Sep 2nd, 2010, 07:57 AM
#7
Thread Starter
Junior Member
Re: Combo Box - How to show drop down menu sans the Mouse.
coolsid: Is this what you want?
Your API sure does the trick. Thanks very much.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|