Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2011 VBnet/Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Distribution: You can freely use this code in your own
' applications, but you may not reproduce
' or publish this code on any web site,
' online service, or distribute as source
' on any media without express permission.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
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
Private Sub Form_Load()
Combo1.AddItem "Item 1"
Combo1.AddItem "Item 2"
Combo1.AddItem "Item 3"
Command1.Caption = "Show List"
Command2.Caption = "Hide List"
End Sub
Private Sub Command1_Click()
'Drop the list
Call SendMessage(Combo1.hWnd, CB_SHOWDROPDOWN, True, ByVal 0)
End Sub
Private Sub Command2_Click()
'Close List
Call SendMessage(Combo1.hWnd, CB_SHOWDROPDOWN, False, ByVal 0)
End Sub
|