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
|
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Select Case KeyCode
Case vbKeyReturn
'touche Entrée appuyée
If ListBox1.ListCount > 20 Then ListBox1.List(0).Delete
ListBox1.AddItem TextBox1
ListBox1.ListIndex = ListBox1.ListCount - 1
TextBox1 = ""
KeyCode = 0 'On change pas de textbox..
Case vbKeyUp
KeyCode = 0
'... rajouter ici le traitement selection dans textbox2..
If ListBox1.ListIndex > 0 Then
ListBox1.ListIndex = ListBox1.ListIndex - 1
End If
TextBox1 = ListBox1.Text
Case vbKeyDown
KeyCode = 0
'... rajouter ici le traitement selection dans textbox2..
If ListBox1.ListIndex < ListBox1.ListCount - 1 Then ListBox1.ListIndex = ListBox1.ListIndex + 1
TextBox1 = ListBox1.Text
End Select
End Sub |