Email Validation Code Using Vb.net For Beinners

Sabarimahesh
Posted by Sabarimahesh under VB.NET category on | Points: 40 | Views : 1582
If Txt_EmailId.Text <> "" Then
Dim Valid As Match = Regex.Match(Trim(Txt_EmailId.Text), "^([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 Valid.Success = False Then
MessageBox.Show("Invalid Emailaddress", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information)
Txt_EmailId.Focus()
Exit Function
End If
End If

Comments or Responses

Login to post response