Self - Learning Module - 2 - Q4
Self - Learning Module - 2 - Q4
02
Managing a Project
Specific Objectives
1. Identify the different event procedure used in writing Visual Basic codes.
2. Understand the property window of Visual Basic based on the control
used.
3. Run and observe simple Visual Basic program.
4. Create Visual Basic project.
Materials
Microsoft Word
Computer
Lesson
Event Procedure
1
Some of the main user actions that execute events in a program
Starting the program
Press a key
Click the mouse
Move the mouse
Close the program
Event Procedure begins with the statement Private Sub and ends with
the End Sub.
Controls allow you to trigger events or perform actions. These are the
building blocks of Visual Basic application. To add controls on the form, double-
2
click the control you want to add or draw the control by clicking the control and
then drag the mouse around the area where you want to put the control.
3
To use the label control
1. Select Label from the toolbox.
2. Draw the label on the previous form.
3. Change the label’s property Name to Jhennylabel.
4. Change the property BorderStyle to 1-frmBorderStyleSingle.
5. Make changes on the code for each CommandButton.
Type the following codes:
for Tinboy CommandButton:
cmdTin.Enabled = True
cmdTinboy.Enabled = False
Jhennylabel.caption = cmdTinboy.caption
4
Change the property Caption to Civil Status.
2. Select Option button. Draw inside the frame.
Change the property Name to optSingle.
Change the property Caption to Single.
3. Select another Option button. Draw inside the frame.
Change the property Name to optMarried.
Change the property Caption to Married.
4. Select Frame again and draw on the form.
Change the property Name to fraChildren.
Change the property Caption to Number of Children.
5. Select TextBox in the toolbox and draw inside the Number of Children
frame.
Change the property Name to txtChildren.
6. Double-click the Single option box, then type the following code.
fraChildren.Enabled = False
txtChildren.Enabled = False
7. Click the X button to exit in the Code Editor window.
8. Double-click the Married option box, then type the following code:
fraChildren.Enabled = True
txtChildren.Enabled = True
9. Run the program by pressing F5 or click button. Observe the frame and
textbox of Number of Children frame.
EXERCISES
BASIC
1. Make an application that can add two numbers. The answer must be
displayed inside the textbox.
2. Make an application that can compute the average of three given
numbers.
5
Closure
A. Please check the box if you can do it already.
B. If you have questions in mind, please use the space below to address it.
__________________________________________________________________________________
__________________________________________________________________________________
__________________________________________________________________________________
References
Amoto Jr., Tito B. Visual Basic 6.0. Quezon City, Book Craft Publishing Co., Inc.,
2001.
https://docs.microsoft.com/en-us/office/vba/language/reference/user-
interface-help/toolbox
https://upload.wikimedia.org/wikipedia/commons/b/b8/Visual_basic_6.0.pdf
https://www.vbtutor.net/lesson1.html