Author | Message | Time |
---|---|---|
haZe | does anyone know how to make a textbox generate random letters as its text? code, please, and yes, its VB if u didnt read the subject :p | March 3, 2003, 11:50 AM |
iago | [code] randomize timer for iIndex = 0 to iAmount txtBlah = txtBlah + chr(int(rnd * 26) + asc("A")) next [/code] This is totally untested, but should fill txtBlah with iAmount random capital characters | March 3, 2003, 12:01 PM |
MesiaH | i use this for random hex char's, it might be able to get you at least started: [code]Public Function RandomLetter(finished As Long) As String Randomize Dim anus As Long anus = Int((Val(finished) * Rnd) + 1) RandomLetter = Hex(anus) End Function[/code] just replace hex(anus) with chr(anus) and it should be fine. | March 4, 2003, 5:40 PM |
Noodlez | [code]Public Function RandomString(Length As Long) As String Dim lLetters As String, uLetters As String lLetters = "1a2b3c4d5e6f7g8h9i0jklmnopqrstuv" uLetters = "ABCDEFGHIJKLM1N2O3P4Q5R6S7T8U9V0" For I = 1 To Length If Int(Rnd * 2) = 1 Then Randomize RandomString = RandomString & Mid$(lLetters, Int(Rnd * 32), 1) Else Randomize RandomString = RandomString & Mid$(uLetters, Int(Rnd * 22), 1) End If Next I End Function[/code] this'll generate a random string containing lowercase/uppercase and the numbers 1-9 usage: Text1 = RandomString(10) | March 5, 2003, 2:10 AM |
haZe | thx that helped a lot | March 5, 2003, 4:48 PM |