|
-
Aug 2nd, 2004, 10:27 AM
#1
Thread Starter
Addicted Member
Random scrolling test (Resolved)
I have a text scroller which I wish to randomly change the text in. As you can see I have two text strings in two variables. I wish to randomly select one or the other and place in the Scroll1.Caption. I can't seem to figure out how to do this. Please help!
VB Code:
Dim scrolltext0 As String
Dim scrolltext1 As String
scrolltext0 = "Down by the pond"
scrolltext1 = "Over by the tree"
Scroll1.Caption = scrolltext
Scroll1.Interval = 0.5
Last edited by purdybirds; Aug 2nd, 2004 at 10:48 AM.
-
Aug 2nd, 2004, 10:32 AM
#2
-
Aug 2nd, 2004, 10:34 AM
#3
Thread Starter
Addicted Member
It's just a third party text scroller like a marque. The only thing to be concerned with is the .caption which is the text being scrolled.
-
Aug 2nd, 2004, 10:38 AM
#4
Need-a-life Member
VB Code:
Dim scrolltext(1) As String
Randomize Timer
scrolltext(0) = "Down by the pond"
scrolltext(1) = "Over by the tree"
'Int((upperbound - lowerbound + 1) * Rnd + lowerbound)
Scroll1.Caption = scrolltext(Int(2 * Rnd))
Scroll1.Interval = 0.5
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
-
Aug 2nd, 2004, 10:45 AM
#5
Thread Starter
Addicted Member
I've tried the code. I've restarted the program 20 times and the same string "Down by the pond" scrolls by. Is this just by chance?
-
Aug 2nd, 2004, 10:48 AM
#6
Thread Starter
Addicted Member
I just saw what is wrong. Your code has randomize timer. I don't have a timer. I removed the timer and it works great now. Thank you very much.
-
Aug 2nd, 2004, 10:51 AM
#7
-
Aug 2nd, 2004, 10:53 AM
#8
Need-a-life Member
You don't need any timer for that code to work.
Randomize Statement
Initializes the random-number generator.
Syntax
Randomize [number]
The optional numberargument is aVariant or any validnumeric expression.
Remarks
Randomize uses number to initialize the Rnd function's random-number generator, giving it a newseed value. If you omit number, the value returned by the system timer is used as the new seed value.
If Randomize is not used, the Rnd function (with no arguments) uses the same number as a seed the first time it is called, and thereafter uses the last generated number as a seed value.
Note To repeat sequences of random numbers, call Rnd with a negative argument immediately before using Randomize with a numeric argument. Using Randomize with the same value for number does not repeat the previous sequence.
Emiliano F. Martín
If a post has helped you then please Rate it! (and give the user points he/she deserves by clicking on the image).
Encourage the person who helped you to keep doing it, and give him the points he deserves.
MP3 Organizer: Freeware to logically organize all your MP3s.
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
|