Verifier qu'un text box ne contient QUE des lettres [a..z][A..Z]
atoguum4ever
Messages postés17Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention12 janvier 2005
-
12 févr. 2004 à 12:56
atoguum4ever
Messages postés17Date d'inscriptionmercredi 23 avril 2003StatutMembreDernière intervention12 janvier 2005
-
12 févr. 2004 à 14:42
:clown) aTomicK :clown)
Salut,
je cherche a verifier qu'un text box ne contient par exemple que des lettres de a ...z et de A...Z .
Je pourrais mettre ces 52 lettres dans un tableau et rechercher chaque caracteres...mais qqun aurait il une solution toute prete ??
Merci
econs
Messages postés4030Date d'inscriptionmardi 13 mai 2003StatutMembreDernière intervention23 décembre 200825 12 févr. 2004 à 13:27
' IMPORTANT
' Référence : Microsoft VB Scripts Regular Expressions 5.5
Function isValidTextBox(chaineATraiter As String) As Boolean
'Check is the version has the correct format
Dim FORMAT_TEXTBOX As RegExp
Dim MATCHES, MATCH As Object
Dim bReturn As Boolean
bReturn = True
Set FORMAT_TEXTBOX = New RegExp
FORMAT_TEXTBOX.Pattern = "[^a-zA-Z]"
Set MATCHES = FORMAT_TEXTBOX.Execute(chaineATraiter)
For Each MATCH In MATCHES
If Len(MATCH.Value) > 0 Then
bReturn = False
End If
Next
isValidTextBox = bReturn
End Function
Private Sub Command1_Click()
MsgBox isValidTextBox(Text1.Text)
End Sub