64 Part I Getting Started with Microsoft Visual Basic 2010
- Type Randomize, and then press ENTER.
The Randomize statement is added to the program and will be executed each time
the program starts. Randomize uses the system clock to create a truly random
starting point, or seed, for the Rnd statement used in the Button1_Click procedure.
As I mentioned earlier, without the Randomize statement, the Lucky Seven program
produces the same string of random spins every time you restart the program. With
Randomize in place, the program spins randomly every time it runs, and the numbers
don’t follow a recognizable pattern.
- Run the new version of Lucky Seven, and then save the project. If you plan to use the
new version a lot, you might want to create a new .exe file, too. - When you’re finished, click Close Project on the File menu.
The files associated with the Lucky Seven program are closed.
Chapter 2 Quick Reference
To Do This
Create a user
interface
Use Toolbox controls to place objects on your form, and then set the
necessary properties. Resize the form and the objects as appropriate.
Move an object Point to the object, and when a four-headed arrow appears, drag the
object.