|
-
Feb 19th, 2005, 03:16 PM
#1
Thread Starter
Addicted Member
Create random number [Resolved]
Hi,
How can I create a random number in a textbox between 1 and 1000?
Last edited by Rogier; Feb 19th, 2005 at 03:36 PM.
Reason: Resolved
-
Feb 19th, 2005, 03:17 PM
#2
Addicted Member
Re: Create random number
you would have to use the RND statement
-
Feb 19th, 2005, 03:21 PM
#3
Thread Starter
Addicted Member
Re: Create random number
and that is.........?
Can you make a code for me please?
-
Feb 19th, 2005, 03:29 PM
#4
Re: Create random number
VB Code:
form_load()
randomize
end sub
command1_click()
rnd (1 - 1000)
end sub
i think thats right, or try 1 * 1000
Last edited by |2eM!x; Feb 19th, 2005 at 03:33 PM.
-
Feb 19th, 2005, 03:35 PM
#5
Thread Starter
Addicted Member
Re: Create random number
ok thanks,
Text1.Text = Rnd
Just what I need.
-
Feb 19th, 2005, 04:53 PM
#6
Re: Create random number [Resolved]
VB Code:
randomize ' seed random number generator
text1.text = int((rnd * 1000) + 1) ' pick random integer between 1 and 1000
this is what you need to use.
-
Feb 19th, 2005, 05:03 PM
#7
Thread Starter
Addicted Member
Re: Create random number [Resolved]
YES!
That's exactly what I want.
Thanks!
-
Feb 19th, 2005, 11:23 PM
#8
Re: Create random number [Resolved]
That's what I thought.
-
Feb 19th, 2005, 11:30 PM
#9
Junior Member
Re: Create random number [Resolved]
yea u need INT(rnd......) to knock off the decimal places since the randomize function does 0-1 but not the whole # 1
randomize **** is fun to play with... i wrote a program that randomizes the back color of the form every milisecond...set it do do 0 - 999999(hexicode for colors and **** thats y theirs 6)
-
Feb 19th, 2005, 11:32 PM
#10
Re: Create random number [Resolved]
 Originally Posted by dglienna
VB Code:
randomize ' seed random number generator
text1.text = int((rnd * 1000) + 1) ' pick random integer between 1 and 1000
this is what you need to use.
text1.text = int((rnd * 1000) + 1) ' pick random integer between 1 and
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
|