Library code snippets

Drop Combo

This code uses the SendMessage API to drop a combo box. Simply add a combo box called cboCombo, and a button named cmdDrop. Note that if you want to close the combo, simply call the SendMessage API using the CB_SHOWDROPDOWN with False instead of True.

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
Private Const CB_SHOWDROPDOWN = &H14F 'WM_USER + 14

Private Sub cmdDrop_Click()
    SendMessage cboDrop.hwnd, CB_SHOWDROPDOWN, True, 0
End Sub

Comments

  1. 13 Apr 2004 at 14:04

    Can anyone tell me how to automatically drop a datacombo upon get focus?  Do I need to use API calls, as well?

  2. 28 Oct 2003 at 09:32

    this code does not works fine with VB.Net the message is not passed to the control..Can any one help??

  3. 24 Jul 2003 at 09:56

     SendMessage cbocombo.hwnd, CB_SHOWDROPDOWN, True, 0


    it should look like this

  4. 01 Jan 1999 at 00:00

    This thread is for discussions of Drop Combo.

Leave a comment

Sign in or Join us (it's free).