cs_petchy
Messages postés710Date d'inscriptionjeudi 20 février 2003StatutMembreDernière intervention19 mai 2015
-
25 août 2007 à 09:29
cs_petchy
Messages postés710Date d'inscriptionjeudi 20 février 2003StatutMembreDernière intervention19 mai 2015
-
26 août 2007 à 08:49
Bonjour
voila, j'ai se code dans un textbox pour mettre que du numéric
Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim chaine
chaine = "0123456789" 'ou d'autre caracteresIf InStr(1, chaine, Chr(KeyAscii)) 0 And Not KeyAscii 8 Then
MsgBox "ATTENTION : chiffre uniquement", vbCritical + vbOKOnly, "ERREUR"
KeyAscii = 0 'On assign un KeyAscii vide à la text box
Text1.Text = "" 'vide la box
End If
mais le probleme c'est que dans une form j'ai 20 textbox qui sont indexé.
comment faire pour appliqué se code à tous mes textbox
merci
petchy
cs_Exploreur
Messages postés4821Date d'inscriptionlundi 11 novembre 2002StatutMembreDernière intervention15 novembre 201615 25 août 2007 à 10:57
Salut Petchy,
Regarde ce lien qui concerne le fait d'avoir que des numériques dans un textbox via API, cela peut-être utile pour cela..L'utilisation en est très simple...
cs_petchy
Messages postés710Date d'inscriptionjeudi 20 février 2003StatutMembreDernière intervention19 mai 20154 25 août 2007 à 10:07
Re
merci pour le code c'est nickel
oui,ils sont vraiment indexés,mais j'ai encore un petit soucis
quand je met un caracteres non numéric il m'affiche bien le message,mais il me vide tous les textbox,et ça c'est génant,y aurait il une astuce pour vider que le textbox qui un caracteres non numéric
Private Sub T1_KeyPress(Index As Integer, KeyAscii As Integer)
Dim chaine
chaine = "0123456789" 'ou d'autre caracteresIf InStr(1, chaine, Chr(KeyAscii)) 0 And Not KeyAscii 8 Then
MsgBox "ATTENTION : chiffre uniquement", vbCritical + vbOKOnly, "ERREUR"
KeyAscii = 0 'On assign un KeyAscii vide à la text box
T1(0).Text = "" 'vide la box
T1(1).Text = "" 'vide la box
End If
End Sub
cs_petchy
Messages postés710Date d'inscriptionjeudi 20 février 2003StatutMembreDernière intervention19 mai 20154 26 août 2007 à 08:49
salut
merci à vous,
j'ai supprimer les lignes pour vider les textboxs et comme ça c'est bon
Private Sub T1_KeyPress(Index As Integer, KeyAscii As Integer)
Dim chaine
chaine = "0123456789" 'ou d'autre caracteresIf InStr(1, chaine, Chr(KeyAscii)) 0 And Not KeyAscii 8 Then
'MsgBox "ATTENTION : chiffre uniquement", vbCritical + vbOKOnly, "ERREUR"
KeyAscii = 0 'On assign un KeyAscii vide à la text box
End If
End Sub
@ plus
petchy