Hello I need help with getting this program to work There is

Hello I need help with getting this program to work. There is waht I have so far:

Public Class Form1


Private Sub btnVerify_Click(sender As Object, e As EventArgs) Handles btnVerify.Click
Dim strPassword As String = \"\"

strPassword = CStr(txtPassword.Text)
\'see if it is valid

If IsValid(strPassword) = True Then
MessageBox.Show(\"The password is valid.\")

ElseIf IsValid(strPassword) = False Then
MessageBox.Show(\"The password is invalid.\")
End If

End Sub

Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
\'Close form
Me.Close()
End Sub


Function IsValid(ByVal strPassword As String) As Boolean
Dim intCount As Integer = 0

\'make sure the password is at least 6 characters long
If strPassword.Length >= 6 Then

\'goes through each character of the text and does the tests for each character
For Each c As Char In strPassword
\'make sure there is at least 1 letter in the string
If Asc(c) >= 65 And Asc(c) <= 90 Or Asc(c) >= 97 And Asc(c) <= 122 Then
\'make sure there is at least 1 number in the string
If Asc(c) >= 49 And Asc(c) <= 57 Then
Return True
Else
Return False
End If
Else
Return False
End If
Next
End If
Return False
End Function
End Class

Solution

Public Class Form1

Private Sub btnVerify_Click(sender As Object, e As EventArgs) Handles btnVerify.Click
Dim strPassword As String = \"\"
strPassword = CStr(txtPassword.Text)
\'see if it is valid
If IsValid(strPassword) = True Then
MessageBox.Show(\"The password is valid.\")
ElseIf IsValid(strPassword) = False Then
MessageBox.Show(\"The password is invalid.\")
End If
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
\'Close form
Me.Close()
End Sub

Function IsValid(strPassword As String)As Boolean
Dim intCount As Integer = 0
Dim checker As New Regex(\"(?=^.{6,}$)(?=.*\\d)(?=.*[A-Z])(?=.*[a-z]).*$\")
   if(checker.IsMatch(strPassword)) Then
       Return True;
   Else
       Return False;
   EndIf
End Function

End Class

Hello I need help with getting this program to work. There is waht I have so far: Public Class Form1 Private Sub btnVerify_Click(sender As Object, e As EventArg
Hello I need help with getting this program to work. There is waht I have so far: Public Class Form1 Private Sub btnVerify_Click(sender As Object, e As EventArg

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site