1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
' Dans (Général) (déclaration)
Dim thekey As Integer
Dim theshift As Integer
Private Sub Combo1_Change()
Dim i As Integer, start As Integer
Dim ShiftDown As Boolean
Dim CtrlDown As Boolean
Dim AltDown As Boolean
ShiftDown = (theshift And vbShiftMask) > 0
CtrlDown = (theshift And vbCtrlMask) > 0
AltDown = (theshift And vbAltMask) > 0
If thekey = vbKeyLeft Or thekey = vbKeyRight Or thekey = vbKeyUp Or thekey = vbKeyDown _
Or thekey = vbKeyBack Or thekey = vbKeyDelete Or ShiftDown Or AltDown Or CtrlDown Then
' Nothing to do now !...maybe later ;-)
Else
start = Len(Combo1.Text)
For i = 0 To Combo1.ListCount - 1
If Left(Combo1.List(i), start) = Combo1.Text Then
Combo1.Text = Combo1.List(i)
End If
Next
Combo1.SelStart = start
Combo1.SelLength = Len(Combo1.Text)
End If
End Sub
Private Sub Combo1_KeyUp(KeyCode As Integer, Shift As Integer)
thekey = KeyCode
theshift = Shift
End Sub |
Partager