0
How to make an email mask in a Windows Forms application ? To using Maskedtextbox that to validate fixed size fields, example: ZIP CODE and CPF the problem is when the mask is of varied size for example the email ?
0
How to make an email mask in a Windows Forms application ? To using Maskedtextbox that to validate fixed size fields, example: ZIP CODE and CPF the problem is when the mask is of varied size for example the email ?
0
You can use namespace System.Text.RegularExpressions;
to generate a rule and calculate it where you wish.
I created a very simple example to illustrate the use of the class Regex
, where I run the rule inside an event click, to show the rule usage. Follow Image below:
As you can see very simple, more knowing the namespace better you will see that the possibilities are numerous.
"^(\d{3}.\d{3}.\d{3}-\d{2})|(\d{11})$"
^\d{5}-\d{3}$
"^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$"
Rule used in the example:
Regex regra = new Regex(@"^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z]{2,})$");
Browser other questions tagged c# winforms
You are not signed in. Login or sign up in order to post.
You’ve already taken a look at the Event Control. ??
– Fernando Souza
I don’t know, but I’ll look it up and get back to you.
– hard123