Archive

Posts Tagged ‘Validation’

How to validate email addess in Windows Forms

March 24th, 2009 Anuraj P 6 comments

Today I want to add validation for email address in a Windows Forms application. I searched google, but didn’t got any simple solution. Then I tried with ASP.Net regex validation control and took the validation expression from it used in RegEx class.

Here is code

static bool IsValidEmail(string Email)
{
Regex regex = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
return regex.IsMatch(emailAddress);
}

Happy Coding [:)]