Option Explicit
Private Const CB_FINDSTRING = &H14C&
Private Declare Function SendMessage& Lib "user32" Alias "SendMessageA" (ByVal hWnd&, ByVal wMsg&, ByVal wParam&, lParam As Any)
Private LastComboKeyAscii&
Sub AutoFillCombo(Combo As ComboBox)
Dim I&, P&
I = SendMessage(Combo.hWnd, CB_FINDSTRING, -1, ByVal Combo.Text) + 1
If I > 0 Then
P = Combo.SelStart
Combo.ListIndex = I - 1
Combo.SelStart = P
P = Combo.SelStart
Combo.ListIndex = I - 1
Combo.SelStart = P
Combo.SelLength = Len(Combo.Text) - P
End If
End Sub
Private Sub Combo1_Change()
If Not (LastComboKeyAscii = 8) And Not (LastComboKeyAscii = 46) Then AutoFillCombo Combo1
LastComboKeyAscii = 0
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
LastComboKeyAscii = KeyCode
End Sub
Private Sub Command1_Click()
Combo1.AddItem Text1.Text
End Sub
Сейчас этот форум просматривают: Bing-бот, Google-бот, Majestic-12 [Bot] и гости: 116