|
-
Dec 26th, 2004, 06:11 AM
#1
Thread Starter
New Member
[Resolved] Random number
Hi all,
I need a function that takes a random NUMBER from 0 to 35. Something like:
Is this possible, and does anyone now ho I can do this?
Last edited by eXziBit; Dec 26th, 2004 at 08:38 AM.
Reason: [Resolved]
-
Dec 26th, 2004, 07:29 AM
#2
Re: Random number
VB Code:
Private Sub Form_Load()
Randomize
End Sub
Private Sub Command1_Click()
Dim num As Integer
num = Int(Rnd * 36)
MsgBox num
End Sub
look at the Rnd() function in msdn to see the syntax plus always put Randomize in the form load event when dealing with ramdom numbers.
casey.
-
Dec 26th, 2004, 08:24 AM
#3
Thread Starter
New Member
Re: Random number
 Originally Posted by vbasicgirl
VB Code:
Private Sub Form_Load()
Randomize
End Sub
Private Sub Command1_Click()
Dim num As Integer
num = Int(Rnd * 36)
MsgBox num
End Sub
look at the Rnd() function in msdn to see the syntax plus always put Randomize in the form load event when dealing with ramdom numbers.
casey.
This gives an error
[edit]It works without the "End Sub".[/edit]
Last edited by eXziBit; Dec 26th, 2004 at 08:37 AM.
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
|