.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal

Home >> Code Snippets >> Regular Expressions >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Check TextBox value is in Email ID Format in C#.net

Posted By:Narayanan       Posted Date: September 27, 2011    Points: 25    Category: Regular Expressions    URL: http://www.dotnetspark.com  

Here,i give a few lines coding for check the value whether Email ID format or Not..

public  static  bool EmailAddressCheck(string emailAddress,int Mode)
            bool functionReturnValue = false;
            if (Mode == 1)
                string pattern = "^[a-zA-Z][\\w\\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\\w\\.-]*[a-zA-Z0-9]\\.[a-zA-Z][a-zA-Z\\.]*[a-zA-Z]$";
                Match emailAddressMatch = Regex.Match(emailAddress, pattern);
                if (emailAddressMatch.Success)
                    functionReturnValue = true;
                    functionReturnValue = false;
                    MessageBox.Show("This is not a Email Format");
            return functionReturnValue;


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend