Textbox et

Résolu
petiflamand Messages postés 675 Date d'inscription samedi 31 mai 2003 Statut Membre Dernière intervention 26 mai 2013 - 5 août 2006 à 11:36
petiflamand Messages postés 675 Date d'inscription samedi 31 mai 2003 Statut Membre Dernière intervention 26 mai 2013 - 5 août 2006 à 11:45
Bonjour je voudrais savoir comment faire avec des textbox
pour avoir des controle sans devoir les retaper completement
je fait le code si dessous mais sa marche pas , merci

Private Sub cuvelier()
If keyAscii = 8 Then Exit Sub
   If keyAscii = 46 Then
       keyAscii = 44
       Exit Sub
   End If
    If keyAscii < 48 Or keyAscii > 57 Then keyAscii = 0
End Sub

Private Sub Text8_KeyPress(keyAscii As Integer)
cuvelier
End sub
Private Sub Text9_KeyPress(keyAscii As Integer)
cuvelier
End sub
Private Sub Text10_KeyPress(keyAscii As Integer)
cuvelier
End sub
ect......

3 réponses

cs_casy Messages postés 7741 Date d'inscription mercredi 1 septembre 2004 Statut Membre Dernière intervention 24 septembre 2014 40
5 août 2006 à 11:40
Essaye ceci peut-etre (si tu oublie les paramètres ça peut pas marcher)

Private Sub cuvelier(keyAscii As Integer)
If keyAscii = 8 Then Exit Sub
   If keyAscii = 46 Then
       keyAscii = 44
       Exit Sub
   End If
    If keyAscii < 48 Or keyAscii > 57 Then keyAscii = 0
End Sub

Private Sub Text8_KeyPress(keyAscii As Integer)
cuvelier(keyAscii)
End sub
Private Sub Text9_KeyPress(keyAscii As Integer)
cuvelier(keyAscii)
End sub
Private Sub Text10_KeyPress(keyAscii As Integer)
cuvelier(keyAscii)
End sub

Sevyc64  (alias Casy) <hr align ="center" size="2" width="100%" /><stron></stron># LE PARTAGE EST NOTRE FORCE #
3
cs_casy Messages postés 7741 Date d'inscription mercredi 1 septembre 2004 Statut Membre Dernière intervention 24 septembre 2014 40
5 août 2006 à 11:42
Un conseil, rajouter Option Explicit sur la toute première ligne de chaque feuille et de chaque module.

Ca t'obligera à déclarer toutes tes variables et ici tu aurais vu que ta variable keyascii dans le sub cuvelier n'existait pas en fait.

Sevyc64  (alias Casy)<hr align="center" size="2" width="100%" /># LE PARTAGE EST NOTRE FORCE #
3
petiflamand Messages postés 675 Date d'inscription samedi 31 mai 2003 Statut Membre Dernière intervention 26 mai 2013 1
5 août 2006 à 11:45
Merci a toi
0
Rejoignez-nous