by Zjuup (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 26th October 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Code generates a password at random by clicking the button on the form. You will need two buttons on your form, named command1 and command2
API Declarations
Randomize (Len(chars))
Dim r
r = Rnd(Len(chars))
Text1.Text = Text1.Text & Mid(chars, CInt(r * Len(chars)) + 1, 1)
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Randomize (Len(chars))
If Len(Text2.Text) > 0 Then
If CInt(Text2.Text) >= 0 Then
Dim I As Integer
For I = 1 To CInt(Text2.Text)
Dim r
r = Rnd(Len(chars))
Text1.Text = Text1.Text & Mid(chars, CInt((r * Len(chars))) + 1, 1)
Next I
End If
End If
End Sub
Private Sub Command3_Click()
Text1.Text = ""
Text2.Text = "0"
End Sub
No comments have been posted about Code generates a password at random by clicking the button on the form. You will need two buttons o. Why not be the first to post a comment about Code generates a password at random by clicking the button on the form. You will need two buttons o.