Information générale
Catégorie:
Codage, syntaxe et commandes
Use The SendMessage Api Declaration to send a message to the Combo box to select the Value as u type ..
Call The Following Function in your
ComboBoxName_KeyPress() event
'-------------------- API Declaration ----------------------
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_FINDSTRING = &H14C
'-------------------- Declaration Over ---------------------
Public Function ComboShowText(C As ComboBox, KeyAscii As Integer)
Dim x As Long
Dim sStr As String
sStr = Left(C.text, C.SelStart) & Chr(KeyAscii)
x = SendMessage(C.hwnd, CB_FINDSTRING, -1, ByVal sStr)
If x >= 0 Then
C.text = C.List(x)
C.ListIndex = x
C.SelStart = Len(sStr)
C.SelLength = Len(C.text)
End If
KeyAscii = 0
End Function
'---------END------------------
Regards, Goga
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement