You are on page 1of 3

VB.

Net
What is Object?
An object is a set/collection of properties and methods.
OR
Object is an instance of a class and it is characterized by state, behavior, and identity.
Properties
An object may have different properties associated with it. The properties can be
accessed as follows:
objectName.propertyName
Suppose we have an object Student with some properties such as Name, Marks and Gender.
These properties can be accessed as follows:
Student.Name =”Umer”
Student.Marks=100
Student.Gender=”Male”
Methods
Methods are used to perform actions. Objects have different types of methods. Some
methods are used to set or get the values of different properties of objects. These methods can
be accessed as follows:
objectName.methodName
Suppose we have an object Student with some methods such as show, close and Gender.
These properties can be accessed as follows:
Student.show()
Student.close()
What is Event?
An event occurs when something happens or an action is performed.
OR
An action or occurrence detected by a program. Events can be user actions, such
as clicking a mouse button or pressing a key, or system occurrences, such as running out
of memory. Most modern applications, particularly those that run in Macintosh and Windows
environments, are said to be event-driven, because they are designed to respond to events.
What is Event Handlers?
An event handler is a piece of code that is executed when an event occurs. Each event handler
is associated with an event.
Events Triggered By The Mouse
Mouse is the most common event of the mouse. The events
triggered by the mouse are called mouse events. These are the most common events in Visual
Basic. Following are the mouse events available in most objects.
Click Event
The click event occurs when the user interact with the object by pressing the left mouse button.

Double Click Event


The double click event occurs when the user interact with the object by quickly pressing the left
mouse button twice.
MouseDown Event
When the user click with the mouse, this action takes place in two parts. One is pressing the
mouse button and the second is releasing the mouse button. Mouse down event is occurs
when the left button of the mouse is being pressed.
MouseUP Event
When the user clicks with the mouse, this action takes place in two parts. One is pressing the
mouse button and the second is releasing the mouse button. Mouse up event is occurs when
the left button of the mouse is being released.
MouseEnter event
This MouseEnter event occurs when the mouse pointer into the control area.
MouseMove Event
This MouseMove event occurs when the user move moue over an object.
MouseLeave event
This MouseMove event occurs when mouse pointer leaves the control area.
MouseHover event
The MouseHover event occurs when mouse pointer rests on the control. A typical use of
MouseHover is to display a tool tip when the mouse pauses on a control within a specified area
around the control.
Events Triggered By The Keyboard
Keyboard is very important way of communication between the use and the program. The
events triggered by pressing the key on keyboard are called keyboard events. These are the
most common events in Visual Basic. Following are the mouse events available in most objects.
KeyDown event
When a user presses a key on the keyboard, this action consists of two parts. One is pressing
the key and the second is releasing the key. KeyDown event occurs when the key is being
pressed.
KeyUp event
When a user presses a key on the keyboard, this action consists of two parts. One is pressing
the key and the second is releasing the key. KeyUp event occurs when the key is being released.
KeyPress event
This event occurs when the user pressed the key on the keyboard. KeyPress event cannot
detect Shift, Alt and Ctrl etc keys.
Events Triggered By The Keyboard
Load event
This event occurs when the form is loaded into the computer memory and before it appears on
the screen.
Resize event
This event occurs, when the size of the form is changed. This event is used to resize the controls
of the form when the size of the form is changed.
FormClosed event
This event occurs after the form has been closed. The FormClosed event occurs after the form
has been closed by the user or by the close method or the Exit method.
FormClosing event
This event occurs before the form is being closed. The FormClosing event occurs as the form is
being closed.
Some other events
TextChanged event
This is a common event for different objects. This TextChanged event is triggered when
contents of the object changed during run time. Forexample, Textchanged event is triggered
whenever text is changed.
Enter event
This is a common event for different object. This event is triggered when we any control is goes
to any object.

You might also like