Practice Exercise 1
Welcome to Visual Basic
OBJECTIVES -- Upon completion of this lab you should be able to:
DESCRIPTION -- In this lab you will create a simple program that shows and hides a label that reads "Welcome to Visual Basic!"
Name, Text, BackColor properties, resizing, and centering.
Name, Text, BackColor, TextAlign, Font and Visible properties.
Name and Text properties.
Setting label's visible property during run time
1. Create a Windows Application project using the same steps that you saw in Running a Program.
2. Click the form to bring up the form's properties.
Set the form's BackColor property to: pale yellow Resize the form to be wider
Resize the form to be wider
3. Add a label control to the form
4. Set the label's text to: Welcome to Visual Basic!
Set the label's name to: lblWelcome
Set the label's BackColor to: Transparent (In
(In Web tab)
Set the label's Font property to: size 24
Set the label's TextAlign property to: MiddleCenter
Set the label's Visible property to: False
5. Resize the label (and possibly the form) to have it resemble the display above.
6. Add two command buttons to the form.
7. Set one command button's text property to: Show
And the command button's name to: cmdShow
Set the other command button's text property to: Hide
And the command button's name to: cmdHide
8. In the cmdShow click event procedure in the code window add the following code:
lblWelcome.Visible = True
In the cmdHide click event procedure in the code window add the following code:
lblWelcome.Visible = False
9. Save the form and project as: Welcome
10. Run the program
11. Print the program