

Public Function GenerateCode()ĭim Numbers As String = "12345678901234567890"ĭim Lower As String = "abcdefghijklmnopqrstuvwxyzyz"ĭim Upper As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZYZ" If someone can point me in the right direction would be great. I am trying and I'm not just posting and hoping someone will do the work for me. In guessing this is something to do with the fact I'm just asking it to generate random password using the characters I give it, and there is no verification that it has used all three of the options.Īny help on this would be awesome.

I have played around with the code and it now generates passwords depending on what I select with the checkboxes which as I say is awesome however I cant always guarantee that if I select, number, upper and lower I will get a password that contains all three, and sometimes the password will only contain numbers even though all three boxes are checked. This enables me to have a checkbox functionality in the form which is a plus. Right I have changed my code a little so I have now got three strings with the different characters in, 1 for uppers, one for lowers and one for numbers.

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub TextBox1_Enter(sender As Object, e As EventArgs) Handles TextBox1.Enter Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click TextBox1.Text =("Please enter a valid password length") StrName = strName & Mid(strInputString, intRnd, 1) If Integer.TryParse(TextBox1.Text, intNameLength) And intNameLength >= 6 And intNameLength <= 20 Then StrInputString = "1234567890ABCDEFGHIJKLMEOPQRSTUWXYZabcdefghijklmnopqrstuvwxyz" Private Function GenerateCode() As Object Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Passwords must be between 6 and 20 characters in length. This doesn't sound very clean and I have been having problems doing this.Ĭan anyone help point me in the right direction or assist with the code below. Once it has one of each it will then generate the rest of the password using my code. I have had a play myself and I was going to have three strings, one with uppercase, one with lower case and a third with numbers. However how I have coded this it will generate a random combination which quite often results in one of the criteria being missed out. I would like each password it generates to have at least 1 number, uppercase and lowercase in it.

I have come up with the below which works however its a bit crude with its password criteria. I have been tasked with creating a visual basic random password generator.
