Effacer textbox
Résolu
JSCH19
Messages postés
128
Date d'inscription
Statut
Membre
Dernière intervention
-
JSCH19 Messages postés 128 Date d'inscription Statut Membre Dernière intervention -
JSCH19 Messages postés 128 Date d'inscription Statut Membre Dernière intervention -
A voir également:
- Effacer textbox
- Comment effacer une page sur word - Guide
- Effacer les données de navigation sur android - Guide
- Effacer iphone - Guide
- Effacer les cookies - Guide
- Comment effacer les messages sur google - Guide
2 réponses
yg_be
Messages postés
23541
Date d'inscription
Statut
Contributeur
Dernière intervention
Ambassadeur
1 583
bonjour,
ton lien n'est pas accessible par tous.
à quel moment faut-il effacer les textboxes?
quelle difficulté rencontres-tu, qu'as-tu essayé?
ton lien n'est pas accessible par tous.
à quel moment faut-il effacer les textboxes?
quelle difficulté rencontres-tu, qu'as-tu essayé?
JSCH19
Messages postés
128
Date d'inscription
Statut
Membre
Dernière intervention
Bonjour yg_be je ne sais pas comment l'expliquer ,cela aurait ete plus comprehensible avec le fichier excel. Je vais essayer d'expliquer, vous savez voir quand vous rentrez la clé d'activation d'un produit etc... puis quand vous rentrez le code dans les textboxes et si la textboxe d'apres n'est pas vide vous ne pouvez pas corriger un contenu dans celle precedente, alors c'est ce que j'aimerais pouvoir faire.En gros comme je dispose de 4 textboxes aligne cote a cote,je veux commencer par effacer le contenu des textboxes en commencant par la quatrieme et une fois celle-ci vide passer automatiquement a la 3eme et ainsi de suite
Option Explicit Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If Me.TextBox2 <> Empty Then KeyCode = 0 End If End Sub Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If Len(Me.TextBox1) = Me.TextBox1.MaxLength - 1 Then Me.TextBox1 = Me.TextBox1 + Chr(KeyAscii) Me.TextBox2 = Empty Me.TextBox2.SetFocus End If End Sub Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If Me.TextBox3 <> Empty Then KeyCode = 0 End If End Sub Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If Len(Me.TextBox2) = Me.TextBox2.MaxLength - 1 Then Me.TextBox2 = Me.TextBox2 + Chr(KeyAscii) Me.TextBox3 = Empty Me.TextBox3.SetFocus End If End Sub Private Sub TextBox3_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If Me.TextBox4 <> Empty Then KeyCode = 0 End If End Sub Private Sub TextBox3_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If Len(Me.TextBox3) = Me.TextBox3.MaxLength - 1 Then Me.TextBox3 = Me.TextBox3 + Chr(KeyAscii) Me.TextBox4 = Empty Me.TextBox4.SetFocus End If End Sub
Tout marche a merveille,des que je me positionne sur la premiere textboxe je ne fais que rentrer les donnees cela passe automatiquement a la deuxieme une fois le maxlength est true ainsi de suite.
je veux faire de meme quand j'efface le contenu des textboxes.
Option Explicit Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If Me.TextBox2 <> Empty Then KeyCode = 0 End If End Sub Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If Len(Me.TextBox1) = Me.TextBox1.MaxLength - 1 Then Me.TextBox1 = Me.TextBox1 + Chr(KeyAscii) Me.TextBox2 = Empty Me.TextBox2.SetFocus End If End Sub Private Sub TextBox2_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If Me.TextBox3 <> Empty Then KeyCode = 0 End If If Me.TextBox2 = Empty Then Me.TextBox1.SetFocus KeyCode = 46 End If End Sub Private Sub TextBox2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If Len(Me.TextBox2) = Me.TextBox2.MaxLength - 1 Then Me.TextBox2 = Me.TextBox2 + Chr(KeyAscii) Me.TextBox3 = Empty Me.TextBox3.SetFocus End If End Sub Private Sub TextBox3_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If Me.TextBox4 <> Empty Then KeyCode = 0 End If If Me.TextBox3 = Empty Then Me.TextBox2.SetFocus KeyCode = 46 End If End Sub Private Sub TextBox3_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If Len(Me.TextBox3) = Me.TextBox3.MaxLength - 1 Then Me.TextBox3 = Me.TextBox3 + Chr(KeyAscii) Me.TextBox4 = Empty Me.TextBox4.SetFocus End If End Sub Private Sub TextBox4_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer) If Me.TextBox4 = Empty Then Me.TextBox3.SetFocus KeyCode = 46 End If End Sub
Voila ce que j'ai essaye