|
-
Jan 26th, 2000, 04:33 AM
#1
Thread Starter
Hyperactive Member
how can I, using Code, force a combo box control to drop down the list? in VBA it's simple:
combo1.dropdown
How can I do the same in VB?
-
Jan 26th, 2000, 04:46 AM
#2
Use the CB_SHOWDROPDOWN API Message with the SendMessage Function, ie.
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
Private Const CB_SHOWDROPDOWN = &H14F
Private Sub Command1_Click()
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, True, ByVal 0&
End Sub
Private Sub Form_Load()
Dim iIndex As Integer
For iIndex = 1 To 10
Combo1.AddItem "Item " & iIndex
Next
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Jan 26th, 2000, 04:50 AM
#3
Thread Starter
Hyperactive Member
Is that the only way to do it? It just seems like it's pretty drawn out for such a simple thing. Having to make an API call to do something so simple. Thanks though
-
Jan 26th, 2000, 05:10 AM
#4
You could use the SendKeys Function, if you wanted to:
Code:
Private Sub Command1_Click()
Combo1.SetFocus
SendKeys "%{DOWN}", 1
End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
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
|