wojc
Messages postés7Date d'inscriptionlundi 11 février 2002StatutMembreDernière intervention 5 juillet 2002
-
11 févr. 2002 à 11:54
wojc
Messages postés7Date d'inscriptionlundi 11 février 2002StatutMembreDernière intervention 5 juillet 2002
-
11 févr. 2002 à 17:12
Bonjour à tous...
J'aimerai Formater mon texte avec la même possibilité que l'OCX Mask, c'est à dire soit entrer un numéro de téléphone ou une date de naissance et que mon textbox affiche automatiquement les séparateurs: "/" et qu'il ny est pas possibilité de rentrer du texte.
BasicInstinct
Messages postés1470Date d'inscriptionmardi 5 février 2002StatutMembreDernière intervention20 octobre 201412 11 févr. 2002 à 12:22
faut faire un truc du style:
et faut rajouter un controle de la date
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Len(Text1) = 10 Then
'limite de la date a 10 caractere : JJ/MM/AAAA
KeyAscii = 0
Else
If KeyAscii <> 8 Then
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End If
Else
'gestion du retour arriere If Len(Text1) 3 Or Len(Text1) 6 Then Text1 = Left(Text1, Len(Text1) - 2)
End If
End If
End Sub
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
If Len(Text1) 2 Or Len(Text1) 5 Then Text1 = Text1 & "/"
If KeyCode > 48 Or KeyCode < 57 Then Text1.SelStart = Len(Text1)
End Sub