Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Feb 9th, 2005, 2:17 PM   #1
cloud-
Hobbyist Programmer
 
Join Date: Jan 2005
Posts: 110
Rep Power: 4 cloud- is on a distinguished road
random numbers on form load ?_?

i used this code for random numbers when the form loads
Private Sub Form_Load()
      MsgBox(Int(Rnd() * 100000))
End Sub
Its always the same number ?_? it should be between
1 and 100000.
or am i doing it wrong

thanks
cloud- is offline   Reply With Quote
Old Feb 9th, 2005, 4:03 PM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Before that statement, use the Randomize function to seed the random number generator based on the system clock.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Feb 9th, 2005, 4:46 PM   #3
cloud-
Hobbyist Programmer
 
Join Date: Jan 2005
Posts: 110
Rep Power: 4 cloud- is on a distinguished road
could you explain it like in a example or something please ^^
i dont really understand
i did try but couldnt get it to work
sorry im a beginner >.<

thanks
cloud- is offline   Reply With Quote
Old Feb 10th, 2005, 12:42 PM   #4
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Sure:
Private Sub Form_Load()
      ' This seeds the randomizer - makes it generate random numbers based on the time
      Randomize
      MsgBox(Int(Rnd() * 100000))
End Sub
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Feb 10th, 2005, 12:49 PM   #5
cloud-
Hobbyist Programmer
 
Join Date: Jan 2005
Posts: 110
Rep Power: 4 cloud- is on a distinguished road
cool it works ^_^

thanks alot
cloud- is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:33 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC