|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Random textbox generation.
Hi,
Im trying to make a program that will generate names in my textbox. I have a form with 10 textboxes and 1 button, im trying to make it so that when i click the button the names will be randomly generated in each textbox. Any ideas? Thanks. |
|
#2
|
||||
|
||||
|
Does it have to be names?
Or can it be just some string of characters?
__________________
IF ADVICE = 'GOOD' INSERT INTO scales (REPUTATION_POINTS, REASON) VALUES (+1, 'BECAUSE ITS GOOD TO DO THAT') END |
|
#3
|
|||
|
|||
|
Well just first name, like Jimbo.
|
|
#4
|
||||
|
||||
|
MSDN Article for Randomize()
I would declare an array, holding all of the names I want to use. That's the part that sucks... you have to put them all in an array. Then, call the randomize function. This gives you a decimal between 0 and 1. Multiply by the number of entries in your array. If Randomize returns 0.975 and you have 100 entries in your array, you end up with 97.5 for your value. Cast it as an Int to get 97, then add 1 to get 98 (this logic gives you 1-100, rather than 0-99). Use this number to access your array and retrieve the name stored in slot 98. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Random textbox generation. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|