AWinLeo
12-04-2008, 02:22 PM
Hi, I'm taking a VB class in school, and I'm going nuts trying to figure something out.
Basically, I need to make a password verification app. It has to be at least 6 characters long, and contain 1 number, and 1 letter. I've been able to get the number check, and length check, but I can't get the letter check.
I thought what the best idea would be is to make a for loop to check for numbers, and if the amount of numbers equals the length of the string, then it would fail the check.
What I coded was this:
For i = 0 To 9
For j = 0 To 9
If txtPass.Text.IndexOf(i) = j Then
intLetterCheck = intLetterCheck + 1
End If
Next j
Next i
If txtPass.Text.Length = intLetterCheck Then
MessageBox.Show("The password must contain a letter!", "No letter.", MessageBoxButtons.OK, MessageBoxIcon.Error)
intLetterVerify = 1
End If
The problem is, that intLetterCheck always just shows the value of 1.
Any advice as to what I'm missing?
Basically, I need to make a password verification app. It has to be at least 6 characters long, and contain 1 number, and 1 letter. I've been able to get the number check, and length check, but I can't get the letter check.
I thought what the best idea would be is to make a for loop to check for numbers, and if the amount of numbers equals the length of the string, then it would fail the check.
What I coded was this:
For i = 0 To 9
For j = 0 To 9
If txtPass.Text.IndexOf(i) = j Then
intLetterCheck = intLetterCheck + 1
End If
Next j
Next i
If txtPass.Text.Length = intLetterCheck Then
MessageBox.Show("The password must contain a letter!", "No letter.", MessageBoxButtons.OK, MessageBoxIcon.Error)
intLetterVerify = 1
End If
The problem is, that intLetterCheck always just shows the value of 1.
Any advice as to what I'm missing?