Results 1 to 7 of 7

Thread: [RESOLVED] Combo Box - How to show drop down menu sans the Mouse.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jan 2008
    Posts
    16

    Resolved [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.

  2. #2
    Hyperactive Member
    Join Date
    Jun 2004
    Posts
    468

    Re: Combo Box - How to show drop down menu sans the Mouse.


  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Jan 2008
    Posts
    16

    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.

  6. #6
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Combo Box - How to show drop down menu sans the Mouse.

    Quote Originally Posted by Indio View Post
    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
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Jan 2008
    Posts
    16

    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
  •  



Click Here to Expand Forum to Full Width