05-17-2011, 09:16 PM
Functions merge into one.
Code:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
If checkemail(TextBox1.Text, TextBox2.Text) = True Then
MsgBox("Email is valid")
Else
MsgBox("Email is invalid")
End If
End Sub
Private Shared Function checkemail(ByVal email As String, pass As String) As Boolean
' If the email matches the regular expression
Dim Expression As New System.Text.RegularExpressions.Regex("\S+@\S+\.\S+")
If Expression.IsMatch(email) Then
If email.Contains("@gmail.com") = True Then
If pass.Length >= 8 Then
Return True
Else
Return False 'Invalid password
End If
Else
Return False 'Not a Gmail
End If
Else
Return False 'Invalid email
End If
End Function