Armyman
unread,Aug 6, 2012, 4:22:46 PM8/6/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to visual-basic-...@googlegroups.com
Here is a neat little code snippet for generating a unique string. Something like a password string.
Function Gen2(ByRef length As Integer) As String
Randomize()
Dim allowableChars As String
allowableChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()"
Dim i As Integer
For i = 1 To length
Gen2 = Gen2 & Mid$(allowableChars, Int(Rnd() * Len(allowableChars) + 1), 1)
Next
End Function
To use this, simply create 2 textboxes (1 for your length of the string and the other for the result) then on a button click, type:
textboxresult.text = Gen2(textboxlength.text)