Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private Sub txtUsername_TextChanged(sender As Object, e As EventArgs) Handles txtUsername.TextChanged
- If txtUsername.Text.Length < 8 Then
- lblUsername.ForeColor = Color.Red
- lblUsername.Text = "X"
- Else
- lblUsername.ForeColor = Color.Green
- lblUsername.Text = "O"
- End If
- End Sub
- Private Sub txtPassword_TextChanged(sender As Object, e As EventArgs) Handles txtPassword.TextChanged
- Dim rawPassword As String
- Dim upper, lower, eight, special, number As Boolean
- upper = False : lower = False : eight = False : special = False : number = False
- Dim ascValue As Integer
- rawPassword = txtPassword.Text
- For counter = 0 To rawPassword.Length - 1
- ascvalue = Asc(rawPassword(counter))
- Select Case ascValue
- Case 65 To 90
- upper = True
- Case 97 To 122
- lower = True
- Case 48 To 57
- number = True
- Case 32 To 47, 58 To 64, 91 To 96, 123 To 126
- special = True
- End Select
- Next
- If rawPassword.Length >= 8 Then
- eight = True
- End If
- If upper = True And lower = True And eight = True And special = True And number = True And special = True Then
- lblPassword.ForeColor = Color.Green
- lblPassword.Text = "O"
- Else
- lblPassword.ForeColor = Color.Red
- lblPassword.Text = "X"
- End If
- End Sub
- Private Sub txtReenter_TextChanged(sender As Object, e As EventArgs) Handles txtReenter.TextChanged
- If txtReenter.Text = txtPassword.Text Then
- lblReenter.ForeColor = Color.Green
- lblReenter.Text = "O"
- Else
- lblReenter.ForeColor = Color.Red
- lblReenter.Text = "X"
- End If
- End Sub
- Private Sub txtPhoneNo_TextChanged(sender As Object, e As EventArgs) Handles txtPhoneNo.TextChanged
- Dim formatString As String
- If txtPhoneNo.Text.Length <> 10 Or Not (IsNumeric(txtPhoneNo.Text)) Then
- lblPhoneNo.Text = "X"
- lblPhoneNo.ForeColor = Color.Red
- Else
- lblPhoneNo.Text = "O"
- lblPhoneNo.ForeColor = Color.Green
- End If
- formatString = txtPhoneNo.Text.Substring(0, 3) & "-" &
- txtPhoneNo.Text.Substring(3, 3) & "-" & txtPhoneNo.Text.Substring(6, 4)
- txtPhoneNo.Text = formatString
- lblPhoneNo.Text = "O"
- lblPhoneNo.ForeColor = Color.Green
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement