Visual Basic 2008 Programming: Business Applications with a Design Perspective
Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9
Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Appendix A Appendix B Appendix C Home
Last change: February 13 2016 18:48:19.

 Chapter in PDF

Chapter 2: Visual Basic Programming Concepts
Last change: February 13 2016 18:48:07.

The Visual Interface

You can now set up the visual interface as shown in Figure 2-16. Follow these steps:

  1. Draw a label and button on the form, taking care of their locations and sizes by following the steps outlined for the previous Welcome example.
  2. Set several properties for the label.
    1. Set its name property to lblWelcome. Use the Properties window to achieve the desired setting. Refer to Section 2.6, “Naming Objects,” for specific steps to change the name property for an object.
    2. Set its Text property to “Welcome to Visual Basic!!!” by using the Properties window. The steps involved should be similar to those used to change the Text property of the button to “Say Welcome” in the previous Welcome example.
    3. Set its Font property to Monotype Corsiva, 24, Bold, and Italic. If your computer does not have this font, set it to your favorite font. The steps to set the font were presented in Section 2.4, “Exploring More Properties.”
    4. Set its BackColor property to red by using the Properties window. Click this property in the Properties window, click the drop-down button in the Property box, click the Custom tab, and select the red color from the color pane.
    5. Set its ForeColor to blue in the same manner as in step 2.d.
    6. Make sure the label is placed vertically in the middle of the form.
  3. Set the form name to frmWelcome and its Text property to Welcome.
  4. Move the button to the lower right corner of the form. Set its Name property to btnQuit and its Text property to Quit.
  5. Add a timer to the form. Notice that this control will appear in the area below the form, but not on the form. It will not appear when your program runs. Change its name to tmrWelcome. (Note that the name prefix for the timer is tmr.) Set its Enabled property to True, and its interval to 250. You will learn what this number means later in this section. The form should appear similar to the one shown in Figure 2-16.

Figure 2-16
The Visual Interface of the revised Welcome project

Last change: February 13 2016 18:48:09.