- Код: Выделить всё
'открыть список при нажатии Enter
Option Explicit
Private Declare Function SendMessageLong Lib _
"user32" Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As Long) As Long
Private Const CB_SHOWDROPDOWN = &H14F
Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Combo1.ListIndex = 9
ComboListVisible Combo1, True
End If
End Sub
Private Sub ComboListVisible(Combo As ComboBox, ByVal Flag As Boolean)
Dim Mess As Long
Mess = SendMessageLong(Combo.hwnd, CB_SHOWDROPDOWN, Flag, 0)
'Combo.MousePointer = 0 'иначе мышь пропадает при вводе некого значения и нажатия Enter
End Sub
Private Sub Form_Load()
Dim i As Long
For i = 1 To 20
Combo1.AddItem "Test Item " & i
Next i
End Sub