To make Password Generator using function vb6 follow this step :
1. Make 1 button (default = command1)
2. Make 1 text box (default = text1.text)
3. Make 1 combo box (default = combo1)
4. Then Paste Code Bellow
Public Function PasswordGenerator(ByVal lngLength As Long) _
As String
On Error GoTo Err_Proc
Dim iChr As Integer
Dim c As Long
Dim strResult As String
Dim iAsc As String
Randomize Timer
For c = 1 To lngLength
iAsc = Int(3 * Rnd + 1)
Select Case iAsc
Case 1
iChr = Int((Asc("Z") - Asc("A") + 1) * Rnd + Asc("A"))
Case 2
iChr = Int((Asc("z") - Asc("a") + 1) * Rnd + Asc("a"))
Case 3
iChr = Int((Asc("9") - Asc("0") + 1) * Rnd + Asc("0"))
Case Else
Err.Raise 20000, , "PasswordGenerator has a problem."
End Select
strResult = strResult & Chr(iChr)
Next c
PasswordGenerator = strResult
Exit_Proc:
Exit Function
Err_Proc:
PasswordGenerator = vbNullString
Resume Exit_Proc
End Function
Private Sub Command1_Click()
Text1.Text = PasswordGenerator(Combo1.Text)
End Sub
Private Sub Form_Load()
Text1.Text = ""
Form1.Caption = "Password Generator by Nazgul"
Command1.Caption = "Generate Password"
Combo1.Text = 1
Combo1.AddItem "1"
Combo1.AddItem "2"
Combo1.AddItem "3"
Combo1.AddItem "4"
Combo1.AddItem "5"
Combo1.AddItem "6"
Combo1.AddItem "7"
Combo1.AddItem "8"
Combo1.AddItem "9"
Combo1.AddItem "10"
End Sub
0 comments:
Posting Komentar