Private Sub TextBox1_Change()
'Si textbox="" sortir
For iTB2 = 1 To Len(TextBox2)
If TextBox1 = Mid(TextBox2, iTB2, 1) Then TextBox1 = "": Exit Sub
Next
If TextBox1 = "" Then Exit Sub
'initialiser ce qui doit l'être à chaque saisie
Nfois = Nfois + 1
Label24 = Nfois
Label24.Width = 20 * Nfois - 10
TextBox2 = TextBox2 & TextBox1
'ensuite viennent les contrôles du jeu
For i = 1 To Nlet
If TextBox1.Text = Mid(TT, i, 1) Then Me.Controls("Label" & i).Caption = TextBox1.Text
Next
For i = 1 To Nlet
If Me.Controls("Label" & i).Caption = "_" Then Nontrouve = Nontrouve + 1
Next
If Nfois = 20 Then
affiche_Mot
MsgBox ("le nom a trouver était: " & TT)
UserForm_Initialize 'relance une nouvelle partie
Exit Sub
End If
If Nontrouve = 0 Then
MsgBox ("BRAVO vous avez trouvé")
PartieGagnee = PartieGagnee + 1 'comptabilise les parties gagnées
UserForm_Initialize 'relance une nouvelle partie
End If
TextBox1 = ""
TextBox1.SetFocus
End Sub