Microsoft Visual Basic 2010 Step by Step eBook

(Tina Meador) #1

52 Part I Getting Started with Microsoft Visual Basic 2010


Writing the Code


Now you’re ready to write the code for the Lucky Seven program. Because most of the
objects you’ve created already “know” how to work when the program runs, they’re ready
to receive input from the user and process it. The inherent functionality of objects is one
of the great strengths of Visual Studio and Visual Basic—after objects are placed on a form
and their properties are set, they’re ready to run without any additional programming.
However, the “meat” of the Lucky Seven game—the code that actually calculates random
numbers, displays them in boxes, and detects a jackpot—is still missing from the program.
This computing logic can be built into the application only by using program statements—
code that clearly spells out what the program should do at each step of the way. Because
the Spin and End buttons drive the program, you’ll associate the code for the game with
those buttons. You enter and edit Visual Basic program statements in the Code Editor.

In the following steps, you’ll enter the program code for Lucky Seven in the Code Editor.

Use the Code Editor


  1. Double-click the End button on the form.


The Code Editor appears as a tabbed document window in the center of the Visual
Studio IDE, as shown here:
Free download pdf