'A sample visual code on how to generate a best random password generator 
Public Function GeneratePassword(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
   'Randomly decide what set of ASCII chars we will use
   iAsc = Int(3 * Rnd + 1)
    'Randomly pick a char from the random set
   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, , "GeneratePassword has a problem."
   End Select
   strResult = strResult & Chr(iChr)
 Next c
 GeneratePassword = strResult
Exit_Proc:
 Exit Function
Err_Proc:
 MsgBox Err.Number & ": " & Err.Description, _
    vbOKOnly + vbCritical
 GeneratePassword = vbNullString
 Resume Exit_Proc
End Function
 
 
3 comments:
Wow, great code on how to generate a best random password.. I love learning visual basic language and I implement this code in future. Thanks for the code and sharing the useful information with us.
This post describe password generator in Visual basic. The method for generating password is easy. I just wrote the syntax and it works perfectly. This is best method for generating the password in Visual basic. Thanks for the information.
Thanks foe sharing this info..
Ecommerce Website Developers Mumbai
Post a Comment