Hi I am having a problem with my password verifer. Right now, with the code I have, everything works except if the password is all alphabetic characters(the password is supposed to include at least one alphabetic and at least one numeric digit) I have been working on this code for a while, anyone have any suggestions on how to display an error message if the password that is entered is just alphabetic characters? Thanks for any input!
Function IsValid()
'Declare variables
Dim strInput As String
Dim password As Boolean = False
Dim Character As Char
Dim intLenth As Integer
While Not password
strInput = InputBox("Please enter one password at a time.")
'For Next loop
For intLenth = 6 To strInput.Length - 1
Character = strInput.Chars(intLenth)
'Checking that there is a digit in the passwords
If Not Char.IsDigit(Character) Then
password = True
Exit For
End If
Next
'If statement that displays a message if a password is valid or not
If password Then
lstBox1.Items.Add("This password is valid!")
Else
MessageBox.Show("Your password must be six characers long and contain one numeric digit and one alphabetic character", "Invalid Password!")
End If
End While
Return IsValid()
End Function