|
-
Apr 8th, 2006, 03:52 AM
#1
Thread Starter
New Member
alphanumeric random string generation in vb6
Dear All,
I jsut have this problem,
I've to develop an alphanumeric string of length 4, which may contain a-z, 0-9, and only @. like 12sd, @1fg, so on..
I've to generate a minimum of 50 characters at one click of create button, and have to display only when the display button is clicked , til lthen the strings have to be in clipboard ready to be pasted anywhere.
once I close the application or load it for the first time, the clipboard should contain the last data.
any idea guys
-
Apr 8th, 2006, 04:21 AM
#2
Addicted Member
Re: alphanumeric random string generation in vb6
I am assuming you have the code to generate the strings.
After creating the strings , write to the clipboard
VB Code:
clipboard.settext "your text here"
To get the clipboard contents
VB Code:
text1.text=clipboard.gettext()
In the formunload event write the clipboardtext to a textfile.
In the foremload event get the text from the textfile.
-
Apr 8th, 2006, 04:59 AM
#3
Hyperactive Member
Re: alphanumeric random string generation in vb6
VB Code:
Private Sub Form_Load()
Debug.Print RandomString(9)
Debug.Print RandomString(9)
End Sub
Function RandomString(Length As Integer) As String
Dim i As Integer
Do While i < Length
Randomize
Select Case IIf(i = 0, Int(1 * Rnd + 1), Int(2 * Rnd))
Case 0: RandomString = RandomString & Chr(Int(10 * Rnd + 48))
Case 1: RandomString = RandomString & Chr(Int(26 * Rnd + 65))
End Select
i = i + 1
Loop
End Function
Should be easy enough to make it use a-z and not A-Z, could use Lower(RandomString(4)) even if you dont get RandomString(). Should be able to modify in '@' effortlessly also.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|