12-11-2004, 01:18 PM
im writing a prog for my vb assessments that has to add a random character onto the end of the contents of a text box, atm i have Randomise in the Form_Load() event and the syntax
& Chr ( Int(Rnd() * (127-33) + 33 ))
which gives some random chars from the ASCII table at the end of the output from the text box, however when it is done adding chars to the range then thats it no more adding chars, and i need it to keep adding the chars something along the lines of
and when it completes one cycle it should then add say an X and repeat, eg when its done the first lot it should go something like
to bottom again then
etc till i give it a command to stop adding random chars
the commands to stop and start are easy enough and i managed to figure out the first method no problem and how to tell it to add itself to any given data in a txtBox and now i have tried so many variations im kinda losing it (LOL)
any guidance appreciated ty A :)
12-11-2004, 02:26 PM
I see no question. What's the problem?
And what is a cycle? I see no cycle.
How are you adding characters to the textbox? What's the significance of the 0 and the X?
12-11-2004, 02:31 PM
Basically, are you wanting to add random characters, but once it's added one, don't use it again? In that case, check out this post: http://www.xtremevbtalk.com/showpost.php?p=128427&postcount=2.
(I also notice you posted this question on VBForums - did you think we wouldn't help you out?)
12-11-2004, 05:03 PM
i posted on 2 forums maybe three as i need the help and figure the more peeps who see it the better, nothing like not thinking no-one wud help, ;)
ill check that link in a min bro and see whats up their and let you know how it goes, and yes i want to add random characters once used not to be used again until all the chars have been added to the initial ones in the said text box and all characters have been used then say an X or a " space * is placed between the chars in the txtbox and the sequence of randoms that r about to be used.
the purpose of the X or the 0 is just an example character that would be used to seperate the outputted datafrom the random chars
, i willclarify what i mean, a random string will be placed into a text box by a user, eg. my tutor, when he clicks the start button a text box will display those characters, continuosly adding a random character each time but never repeating itself, so if he were to type in my course prefix (hn4)and he clicked start the he would maybe get an output of
and once all the possible ASCII characters are used in the 4th column, apart from 1 (lets sat an uppercase X for example) had been used and displayed in the box the unsed char would be placed at the end of the sequence like
untill all the ASCII chars are used in the 5th column this time, and the procedure would start again making the list of entries as long as you like but with no 2 entries being the same until a stop command is delivered.
right ill go check that link to post br0 and let you know how i get on, as at the moment the code
textbox1.text + chr (Int(Rnd() * (127 - 33) + 33))
perfoms 1 "cycle" of the program because that syntax only allows random chars at the end of the chars in the textbox one time, (127 of the ASCII chars i did not include a space) and i need it to occur until a stop command is sent.
thank you and peaceout
hmm not a major point cause it dont affect anything but iss 33 correct for a space? im thinking 32 hmmmmm ;)
12-11-2004, 05:15 PM
mike thanks very much for the link mate as i searched on this for over a week till i joined forum and asked for help, so im so happy things are moving again :p ty
in that post the first method would be ideal for my purpose can you advise me how i should implement this, or what do i need to tell my program to get the number from this sub and add it to the contents of the text box?
peace A :)
12-11-2004, 08:07 PM
Yes, 32 is space.
To convert the numbers into characters, you would use Chr() to convert them into characters. :)
12-11-2004, 09:10 PM
ty guys after reading the rest of the thread (once i realised it was their!!) i got it all working fine
once again ty very much