Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 172
0 Users 2 Guests Online

Random password generator

First of all make a standard exe and make 2 text boxes name: Text1 Text2
Text1 - This will be where the user will type the length of the password

Text2 - Where the random password will display

Now crate a command button double click on it and enter this code-
Code

'Sets the variables
Dim Characters As String
Dim pwd As String
Dim tStore As String

'Stores which characters the generator will use.
Characters = "acbdefghijklmnopqrstuvqxyz1234567890"


For c = 1 To Text1.Text
Randomize

'Choose a random number
tStore = Rnd * 36
'Rounds the numbers
tStore = Round(tStore, 0)

'This prevents is causing an error if the random number was 0
If tStore = "0" Then
tStore = "2"
End If

'Gets the position of the character from the number (say the random number was 3 the letter would be c etc... )
pwd = pwd & Mid(Characters, tStore, 1)


Next

'After it's looped the length amount u set, It will display the password in text2.
Text2.Text = pwd

Very simple but it will help! Here is an example i did
6 letters
gu8sl4

and 8 letters
dj7f5cd3
MOD-Dan
Author:
Views:
1957
Rating:
Posted on Sunday 21st October 2007 at 09:43 AM
Dalez
Dalez
Yeah it says theres and error:
For c = 1 To Text1.Text
Posted on Sunday 15th July 2007 at 01:01 AM
Joshua
Joshua
Hmm, seems to bee an Error...

For c = 1 To Text1.Text
Posted on Wednesday 11th July 2007 at 05:22 PM
FtH8er
FtH8er
he asked so i told him, its not like im trying to take his tut over or nothing, cause its a nice basic vb tut.
Posted on Wednesday 11th July 2007 at 01:53 PM
vb_king
vb_king
FtH8er you don't need to put that...
Posted on Wednesday 11th July 2007 at 01:21 AM
FtH8er
FtH8er
umm I believe you put this under the defined variables:

On Error GoTo ErrorHandler

and then at the end of the thing you would put what you want the ErrorHandler to say so like this:

ErrorHandler:
MsgBox "You Have Created An Error And Cause The Program To Malfunction. Please Go Back And Correct Your Error.", vbInformation, "Exotic Calculator Error"


This is not a guarentee as i have yet to try it with this code, but it works with other things so dont get to mad if it done work lol
Posted on Sunday 17th June 2007 at 08:24 PM
Diablosblizz
Diablosblizz
If somebody doesn't enter anything they I get an error.

How do I fix it so it shows a Error Message and not close the program.