Link to home
Start Free TrialLog in
Avatar of gvsbnarayana
gvsbnarayana

asked on

Drop Down Combobox programatically??

Hi All,
    is it possible to drop down a Combobox programatically? I am trying to show a combobox on click on a datagrid. I am able to show the combobox on click on the grid but not able to drop it automatically so that the user can directly select.
Thanks in advance.
Regards,
Badri.
ASKER CERTIFIED SOLUTION
Avatar of Monchanger
Monchanger
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of farsight
farsight

Private Declare Function SendMessage _
    Lib "user32" _
    Alias "SendMessageA" ( _
        ByVal hwnd As Long, _
        ByVal wMsg As Long, _
        ByVal wParam As Long, _
        lParam As Long _
        ) As Long

Private Const CB_SHOWDROPDOWN    As Long = &H14F

Public Sub ComboDropdownHide(ByVal cbo As VB.ComboBox)
    SendMessage cbo.hwnd, CB_SHOWDROPDOWN, False, 0
End Sub

Public Sub ComboDropdownShow(ByVal cbo As VB.ComboBox)
    SendMessage cbo.hwnd, CB_SHOWDROPDOWN, True, 0
End Sub

This is what I use and it works great.

Private Sub Combo1_GotFocus()
    SendKeys "{F4}"
End Sub
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
- answered by Monchanger
Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

twalgrave
Cleanup Volunteer
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange