There is an issue with this code which is when the program is run it will generate the correct passwords, but when the Clear button is pressed the NumHowMany & numLength is incorrect it swaps the 2 around, can anyone see any issues? if u need more info please ask. Hope i explained well.
Private Sub btnGen_Click(sender As System.Object, e As System.EventArgs) Handles btnGen.Click
Dim r, i, Counter, Numb, Length
Dim Password As String
Counter = -0
If lstPass.Items.Count <= numLength.Value Then
Length = numLength.Value
Numb = numHowMany.Value
If Numb = 0 Then
MsgBox("You need to enter the amount of Passwords that you want Generated.", vbOKOnly + vbCritical, "How Many?")
Else
Length = numLength.Value
If Length = 0 Then
MsgBox("You need to enter the Length of the Passwords you want to create.", vbOKOnly + vbCritical, "How Long?")
Else
While Counter <= Length - 1
Counter = Counter + 1
Password = ""
For i = 1 To Numb
Randomize()
r = Int((Rnd() * 61) + 1)
Password = Password & Mid(Chars, r, 1)
Next i
lstPass.Items.Add(Password)
End While
btnGen.Enabled = False
btnClear.Enabled = True
End If
End If
Else
lstPass.Items.Clear()
btnGen.Enabled = True
btnClear.Enabled = False
End If
End Sub