Bonjour, j'ai 2 soucis

quand je click sur la touche entrée qui je pense correspond au code ASCII 13 d'après les forrums il doit m'exécuter une procédure

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Private Sub Command3_KeyPress(KeyAscii As Integer)
Dim nom As String
Dim prenom As String
Dim i As Integer
Dim cpt As Integer
cpt = 0
List1.Clear
 
If KeyCode = 13 Then
 
For i = 1 To nbEleves
    If Text1.Text = Mid(T(i).classe, 1, Len(Text1.Text)) Then
        cpt = cpt + 1
        List1.AddItem (T(i).nom & T(i).prenom)
    End If
Next i
MsgBox ("il y a " & cpt & "éléves dans la classe")
If cpt = 0 Then
MsgBox ("cette classe existe pas")
End If
 
End If
 
End Sub
quand je clique sur sur la touche entrée apres avoir rempli la text1.text il devrai afficher dans une liste