Validate Email Address in VB.Net
Public Function ValidateEmailID(ByVal emailAddress As String) As Boolean
If Regex.IsMatch(emailAddress, "^[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]$") Then
ValidateEmailID = True
Else
ValidateEmailID = False
End If
End Function
How to check where the email address is valid or not.
If ValidateEmailID(txtemaild.text) = False Then
MsgBox("Invalid Email Adddress ")
txtemailid.Focus()
Exit Function
End If
No comments:
Post a Comment