VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Generates a random alphanumeric string of user controlled length. Usage: MsgBox RandomString(50) wo

by Denis Petrusenko (6 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sat 29th December 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Generates a random alphanumeric string of user controlled length. Usage: MsgBox RandomString(50) would return a 50 character random string.

Rate Generates a random alphanumeric string of user controlled length. Usage: MsgBox RandomString(50) wo




 Dim t As Integer, v As String, X As Currency

 For X = 1 To l

  Randomize
 
  t = Int((3 * Rnd) + 1)
 
  If t = 1 Then v = v & Chr(Int((26 * Rnd) + 1) + 96)
  If t = 2 Then v = v & Chr(Int((26 * Rnd) + 1) + 64)
  If t = 3 Then v = v & Chr(Int((9 * Rnd) + 1) + 48)
 
 Next
 
 RandomString = v

End Function

Download this snippet    Add to My Saved Code

Generates a random alphanumeric string of user controlled length. Usage: MsgBox RandomString(50) wo Comments

No comments have been posted about Generates a random alphanumeric string of user controlled length. Usage: MsgBox RandomString(50) wo. Why not be the first to post a comment about Generates a random alphanumeric string of user controlled length. Usage: MsgBox RandomString(50) wo.

Post your comment

Subject:
Message:
0/1000 characters