I'm new to vb6, i just wanna ask something..

i want to create a Progress Bar race game in vb6, my question is how do i randomize progress bar speed?assuming that i have FIVE Progress Bars, any help is appreciated..thanks!:)

5 Years
Discussion Span
Last Post by BitBlt

It depends on if you want the race winner pre-determined.

For example, you could set the Max property of each progress bar individually to a random number, then loop through a number of iterations, increasing the Value property of each progress bar until the smallest Max value of the group is reached. First one to its own Max wins.

If you don't want the race winner pre-determined, then set the Max value of each progress bar the same, and inside your loop, randomize the amount to increase the Value property of each progress bar individually. Then you increase the Value randomly until one Value reaches Max.

To make it REALLY interesting, do both. So you have progress bars with different Max property values, and you are increasing the Value randomly during your loop.

And, if you want to "animate" the race (to make it exciting), put in a separate inside loop (say, 100,000 iterations?) with a DoEvents statement inside.

There are some other interesting things you'll have to do to avoid "gotcha" situations, but I'll leave you the joy of discovering those yourself.

Good luck, and have fun with it!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.