Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically opening the dropdown of a combobox when focus is receive 1

Status
Not open for further replies.

CruiseMan

Programmer
Nov 17, 2006
29
0
0
US
Can anyone tell me a way to have a Type 2 combobox (VB6) open it's dropdown list when the control receives focus (instead of having the user click the down arrow of the control to open it).

Thanks!
 
Private Sub Combo1_GotFocus()
Sendkeys "{F4}",True
End Sub

Generally works well, do it again and the combo dropdown lifts.

Alernatively;

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 Combo1_GotFocus()
SendMessage Combo1.hwnd, CB_SHOWDROPDOWN, True, ByVal 0
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top