this is going to be interest , i am using regex here regex means regular expressions so lets get started , you just need to add a textbox and a button by the way if i say directly you need a button click event so this will work like this , you enter an email address and click on the button so if the email address you have entered is valid then a message box will popup and say that also if the email address you have entered incorrect then a message box will popup saying invalid email address
add a textbox and a button add this namespace
add a textbox and a button add this namespace
Imports System.Text.RegularExpressionsdouble click your button and add this code
'Author : Mohamed Shimran 'Blog : http://www.ultimateprogrammingtutorials.blogspot.com Dim Valid As Boolean Try Valid = Regex.IsMatch(TextBox1.Text, "\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase) Catch ex As Exception End Try If Not Valid Then MsgBox("invalid Email Address") TextBox1.Clear() Else MsgBox("Valid email") End Ifdone
4 comments
shim
ReplyThis is an excellent library for verifying email addresses:
http://www.kellermansoftware.com/p-37-net-email-validation.aspx
thanks :)
Replythanxx bro
ReplyWaw, perfect, Cheers!
ReplyPost a Comment
Note: Only a member of this blog may post a comment.