I have copy the code from this forum but there are still some error in validate the "@" symbol in email,the email can always be valid if symbol "@" is none...can anyone help...
VB.NET:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim email As String = Me.email.Text.Trim.ToLower()
Dim isValid As Boolean = True
If email.Length >= 6 Then
If email.CompareTo("@") Then
If email.EndsWith(".com") OrElse email.EndsWith(".edu") OrElse email.EndsWith(".net") OrElse email.EndsWith(".org") Then
'Do Nothing
Else
isValid = False
End If
Else
isValid = False
End If
Else
isValid = False
End If
If isValid = True Then
MessageBox.Show("Address Valid")
Else
MessageBox.Show("Address Invalid")
End If
End Sub