Validate Email Address in VB.Net

Respons: 0 comments

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  
       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 ")  
       Exit Function  
  End If  

No comments:

Post a Comment

Copyright © MS SQL MS-ACCESS

Sponsored By: GratisDesigned By: Habib Blog