|
-
Oct 1st, 2000, 10:50 PM
#1
Thread Starter
Frenzied Member
Is it possible to hit a command button and have a drop down list drop down so the user can see all the choices without clicking on it first?
Thanks,
Dan
-
Oct 2nd, 2000, 01:15 AM
#2
Addicted Member
You could try having a hidden listbox under the button and use the following code.
Code:
Private Sub command1_Click()
list1.visible = True
End Sub
Regards
Matt Brown
Hamilton, NZ
VB6 C++ in Visual Studio 6sp4
VB.net Beta 1
-
Oct 2nd, 2000, 01:43 AM
#3
Or you can send a message to the combo box eg:
SendMessage Combo1.hWnd, CB_SHOWDROPDOWN, 0, 0
which does the same thing
- gaffa
-
Oct 2nd, 2000, 06:33 AM
#4
Here are the functions you need in order for the code above to work.
Code:
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long
Const CB_SHOWDROPDOWN = &H14F
-
Oct 2nd, 2000, 08:19 AM
#5
Thread Starter
Frenzied Member
Thanks for the help Mathew and gaffa, but it doesn't do a thing.. I put Mathew's code in the module and put gaffa's code verbatum (except for putting in the proper combo box name) behind the command button but it doesn't do a thing..
Any ideas?
Thanks,
Dan
-
Oct 2nd, 2000, 04:09 PM
#6
I was at skool when I posted, so I couldn't test it.
Try this:
Code:
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 = &H14F
Private Sub Command1_Click()
Dim lRet as long
lRet = SendMessage(Combo1.hwnd, CB_SHOWDROPDOWN, 1, ByVal 0&)
End Sub
By the way, Mathew = Matthew = two t's.
-
Oct 2nd, 2000, 06:27 PM
#7
_______
<?>
Code:
'drop down a combobox when it gains focus
Dim bAlreadyDown As Boolean
Private Sub Combo1_DropDown()
bAlreadyDown = True
End Sub
Private Sub Combo1_GotFocus()
If bAlreadyDown = False Then SendKeys ("{f4}")
bAlreadyDown = False
End Sub
Private Sub Combo1_LostFocus()
bAlreadyDown = False
End Sub
Private Sub Command1_Click()
Combo1.SetFocus
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|