For validation improvments(for my textbox)

Johnson

Well-known member
Joined
Mar 6, 2009
Messages
158
Programming Experience
Beginner
Hi, on my form i have 2 text boxes. One email the other password. Her eis my code

VB.NET:
    Private Sub btnLog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLog.Click
        If String.IsNullOrEmpty(txtMail.Text) Then
            'txtMail is empty
            MessageBox.Show("Email is empty", "Error", MessageBoxButtons.OK, _
                            MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
        ElseIf String.IsNullOrEmpty(txtPsswd.Text) Then
            'txtPassword is empty
            MessageBox.Show("Password is empty", "Error", MessageBoxButtons.OK, _
                MessageBoxIcon.Error, MessageBoxDefaultButton.Button1)
        End If
    End Sub

How can i make this more efficient. So that txtMail checks for text first then @ then more text then .com or something? i,m sure you know what i mean.

and textpassword is more then 2 or three chars?

thanks
 
Back
Top