Transaction Management in Database Management System
Technology and Livelihood Education IV
1.
2. OBJECTIVES
•Understand what is an object
•Learn the properties, methods
and events that correspond with
an object
•Learn the use of the Properties
Window
3. Everything in Visual Basic
revolves around what is
called as OBJECTS.
Objects are a distinct unit in a
program that has a certain
characteristics and can perform
certain actions.
4.
5. Objects have PROPERTIES, just like a real-world
object, properties determines what physical
appearance your object will look like. You can change
the different properties of each objects.
ObjectName.Property=Value
Object Name = Name of the object with the properties to
change
Property = attribute you want to change
Value = New data of the property
7. • You can also change
the Property of an
object at design time
by using the Properties
Window in Visual
Basic.
8. Objects can also perform functions of their own. The
whole point of creating objects is that objects does
something useful. This additional functions are known
as METHODS. This allows the objects to perform
certain actions.
ObjectName.Method Value
Object Name = Name of the object with the properties to
change
Method = action to perform
Value = Optional parameters or data you can add
10. To add data to a ComboBox we can use
the methods optional parameter
Combo1.AddItem “IV-Malory”
11. The form is the basic repository for all you controls, this is were
you add all those controls when you design the user interface. A
program can have one or more forms. The form that first appear
when you run you program is called the startup form.
You can change the order of the startup of each form by:
1. Clicking Project from the menu bar
2. Select Project1 Properties
3. The Project Properties will appear
4. Click the Startup Object combo box
5. Select from the list of forms
6. Then click the OK button
12. Each form and control has properties
assigned to it by default when you start up
a new project. There are two ways to
display the properties of an object. The
first way is to click on the object (form or
control) in the form window. Then, click on
the Properties Window or the Properties
Window button in the tool bar. The second
way is to first click on the Properties
Window. The select the object from the
Object box in the Properties Window.
Properties can be viewed in two ways:
• Alphabetic
• Categorized
13. Each object has a set of attributes,
called properties, that determine its
appearance and behavior
The Properties window exposes the
object’s properties to the programmer
The Properties window includes an
Object box and a Properties list
The Properties window can be used to
change a property of an object
15. The Windows Form object has a set
of properties
Properties of the Windows Form
object will appear in the Properties
window when you select the
Windows Form object in the
designer window
16. Important properties of the Windows
Form object:
Name property
Text property
StartPosition property
Size property
BackgroundImage property
17. You can also set or modify properties while
your application is running . To do this, you
must write some code. The code format is:
ObjectName.Property = NewValue
Such a format is referred to as dot notation.
For example, to change the BackColor
property of a form name Form1, we’d type:
Form1.BackColor = vbBlue
18. The names you assign to objects are used by
Visual Basic to set up a framework of event-driven
procedures for you to add code to. The
format for each of these subroutines (all
object procedures in VB are subroutines) is:
Sub ObjectName_Event (Optional Arguments)
End Sub
VB provides the Sub line with its arguments
(if any) and the End Sub statement. You
provide any needed code.
19. Several form events will fire starting with the moment of
creation. Each has its own purpose and triggers in a certain
order. When the Form is first created, an initialize event will
occur, followed by Load, Resize, and Paint.
1. Start VB and create a new project
2. Double-click the form
3. The Code Window will appear, by default
you’ll be in the Load event procedure, click
on the events combo box, scroll through and
select the Click event.
4. You’ll now have two event procedure (Load and
Click)
5. Click inside the Form_Click event and type
the following statement
6. Your code window should look like the one in
the next slide.
21. Properties Description
Caption Changes the caption of the title bar in the form
Window.
Appearance Changes the 3D or Flat appearance of the form
BackColor Changes the form background color
Font Changes the Font style of the form
Enable Sets True of False boolean data, disables and
enable the form
Picture Puts a picture on the form
Visible Hide or unhide the form by setting it True or
False
ForeColor Changes the color of the text
22. Events Description
Load Triggers once the program starts
Unload Triggers once the program exits
Activate Triggers once the form is active
Click Triggers once the form is click
Double Click Triggers once the form is double click
Terminate Like Initialize, this event will only occur during
the existing of the Form. It won’t fire if the
program is terminated abnormally
Initialize This event occurs only once when the Form is
created. It will not fire again unless the Form is
Unloaded and Loaded again
23. Methods Description
Hide Hides the active form
Unhide Unhide the active form
Print Use to print text on the form
Cls Clear any picture on the form