252 Part II Programming Fundamentals
You don’t need to keep this project on your hard disk; it was only for testing purposes.
To demonstrate the “close without saving” feature in Visual Studio, you’ll discard the
project now.
- Click the Discard button.
Visual Studio discards the entire project, removing any temporary files associated with
the module from your computer’s memory and hard disk. It seems like a rather obvious
feature, but I wanted to demonstrate that the ability to close a project without saving
it is just the thing for this type of test. (Just be careful with it, OK?) Now you’ll open
a more substantial project and modify it.
- Open the Track Wins project in the C:\Vb10sbs\Chap10\Track Wins folder.
The project opens in the Integrated Development Environment (IDE).
- If the form isn’t visible, display it now.
You see the following user interface:
The Track Wins project is the same slot machine program that you created in Chapter 2.
With this program, the user can click a spin button to display random numbers in three
number boxes, and if the number 7 appears in one of the boxes, the computer beeps
and displays a bitmap showing an eclectic cash payout. I’ve simply renamed the Lucky7
solution in this chapter so that you won’t confuse this new version with the original.
- Click the Start Debugging button on the Standard toolbar to run the program.
- Click the Spin button six or seven times, and then click the End button.
As you might recall, the program uses the Rnd function to generate three random
numbers each time you click the Spin button. If one of the numbers is a 7, the event
procedure for the Spin button (Button1_Click) displays a cash payout picture and beeps.
Now you’ll edit the form and add a module to enhance the program.
Add a module
- Click the Label control in the Toolbox, and then create a new rectangular label on the
form below the Lucky Seven label.