Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hello all experts
i want a good and complete mask for c# winforms maskedtextbox that inputed email addresses
could everyone help me?
thnak you all
Posted
Updated 26-Aug-12 1:36am
v2
Comments
Volynsky Alex 26-Aug-12 7:42am    
Please read following post:
http://stackoverflow.com/questions/5107309/email-address-hiding-some-characters-with-c-regex

1 solution

Hi ,
I recommend for you using Regular Expression
Check this

C#
private void BtnSave_Click(object sender, EventArgs e)
{
    Regex reg = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$");
    if (!reg.IsMatch(textBox1.Text))
    {
        errorProvider1.SetError(textBox1, "Email not valid");
    }

    else
    {
        errorProvider1.Dispose();
    }
}

Best Regards
M.Mitwalli
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900