Microsoft Visual Basic 2010 Step by Step eBook

(Tina Meador) #1

Chapter 10 Creating Modules and Procedures 253



  1. Set the properties shown in the following table for the new label. To help identify the
    new label in the program code, you’ll change the new label object’s name to lblWins.


Object Property Setting
Label5 Font
ForeColor
Name
Text
TextAlign

Arial, Bold Italic, 12-point
Green (on Custom tab)
lblWins
“Wins: 0”
MiddleCenter

When you’ve finished, your form looks similar to this:

Now you’ll add a new module to the project.


  1. Click the Add New Item command on the Project menu, select the Module template,
    and then click Add.
    A module named Module1 .vb appears in the Code Editor.

  2. Move the insertion point to the blank line between the Module Module1 and End
    Module statements, type Public Wins As Short, and then press ENTER.
    This program statement declares a public variable of the Short integer type in your
    program. It’s identical to a normal variable declaration that you might make in your
    program code, except the Public keyword has been substituted for the Dim keyword.
    When your program runs, each event procedure in the program will have access to this
    variable. Your module looks like this:

Free download pdf