C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » C# Syntax »

Email validation for TextBox control in c#.net windows application


Posted Date: 28 Oct 2009    Resource Type: Code Snippets    Category: C# Syntax
Author: Srikanth ReddyMember Level: Silver    
Rating: 1 out of 5Points: 5




private void button1_Click(object sender, EventArgs e)
{
if (textBox1.Text.Trim() != "")
{
Match rex = Regex.Match(textBox1.Text.Trim(' '), "^([0-9a-zA-Z]([-.\\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\\w]*[0-9a-zA-Z]\\.)+
[a-zA-Z]{2,3})$", RegexOptions.IgnoreCase);
if (rex.Success == false)
{
MessageBox.Show("Please Enter a valid Email-Address ", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
textBox1.Focus();
return false;
}
else
{
return true;
}
}
else

{
return true;

}

}




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Validate email address in textbox using c#.net  .  Email validation in windows application  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Add image to word in C#
Previous Resource: Application to decompress file in asp.net
Return to Discussion Resource Index
Post New Resource
Category: C# Syntax


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use