Need a little help with an application I'm creating. Its just a simple password generator. I have the application generating the password with no issues but I need to add a step in that checks for: 1 uppercase letter, 1 lowercase letter, 1 number and 1 special character before displaying the password. If the password doesn't contain these values the password should then generate again.
I would like to keep the code I have, i just want to add a step in at the end.
Thanks a lot in advance.
Here is my code:
Public Class Form1
Dim AllCharacters As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789?!£$%^&*()_+[];'#,./?><~@:}{\|"
Dim r As New Random
Dim charIndex As Integer
Dim finalpassword As String
Dim passwordChars1() As Char = New Char(9) {}
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
For i As Integer = 0 To 9 - 1
charIndex = r.Next(AllCharacters.Length)
passwordChars1(i) = AllCharacters(charIndex)
Next
finalpassword = passwordChars1
passwordbox.Text = finalpassword 'Displays Password on Main Form Window
End Sub