JoePatent
Messages postés171Date d'inscriptionjeudi 30 janvier 2003StatutMembreDernière intervention20 juillet 2008 2 déc. 2004 à 17:03
Private Sub Text2(1)_KeyPress(KeyAscii As Integer)If InStr("0123456789", Chr(KeyAscii)) 0 Then KeyAscii 0
End Sub
Quand tu es dans un groupe, l'entete devrait plutot se lire comme suit
Private Sub Text2_KeyPress(KeyAscii As Integer, index as integer)
de sorte que si tu ne te préocupes pas de l'index, le code a l'Interieur ne change pas. Et tout les text box seront affecté egalement.
Toutefois, si tu veut que certain textebox ait du texte et d'autre seulement des chiffres, voici un exemple de code a mettre dans l'evenement.
Private Sub Text2_KeyPress(KeyAscii As Integer, index as integer)
case select Index
case 1,3,5
if estChiffre(keyascii) then keyascii = 0 end if
end select
end sub