|
-
Jul 8th, 2005, 05:12 PM
#1
Thread Starter
Hyperactive Member
Random number if = True
Guys,
This question may sound complicated... And I was hoping it's possible to do it. what I wanted is to have random number to change when variable is true or 1, then change the random number can change back to original when variable is false or 0 for example here's snippet:
VB Code:
Dim Lucky As Byte
Dim LuckyNum As Variant
If Lucky = 1 Then
Lucky = 258 + 2 + 4 - 1
Else
Lucky = 258 - 2 - 4 + 1
End If
LuckyNum = Lucky
Print format(LuckyNum, "000" ' If true Print will show 263 otherwise it will go back to number 258
I have tried this similar code using command1 button as if I pressed to be true, and I end up with overflow and could not understand why, Also, I was expecting number to increase sequently in delay time for instance when its true or 1, the display will show 258,260,264 then 263. When its false or 0 it will countdown sequently 264,260,258 and etc. Perhaps, I have done wrong or anything. done search on this site seeing if anyone ever encountered or trying these methods... and end up with no luck. Can anyone help?
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
|