Objects and their Event Procedures
What are an ObjectÆs Event Procedures?
Here is a list of some of your personal Event Procedures?
Procedure Event that Triggers it Laugh Something funny happens Eat Hunger Sleep Exhaustion Cry Sadness/happiness Objects (Controls) in a Visual Basic program have Event Procedures as well. Here are just some of the Event Procedures shared by most Visual Basic Objects:
Procedure Event that Triggers it Click The Object was clicked on with the mouse KeyDown A key was pressed while the Object had the focus KeyUp A key was released while the Object had the focus MouseMove The mouse was moved while it was over the Object MouseDown A mouse button was pushed down over an Object Leave The currently selected Object is about to lose the focus
Why are Objects (controls) and their Event Procedures important in Visual Basic?
When you place a Button control into a Visual Basic program, you would normally want to allow users to click on it. The Button control comes with an Event Procedure called Click, that is automatically executed when the button is clicked on. Most of the Event Procedures that come ready-made with a Control are the ones that you will most commonly need. You also have the option of adding your own custom event handlers to an object.
To access an ControlÆs Event Procedures, double-click on the Control after placing it on a form. This opens the Code window and displays that control's default event procedure. Note: Visual Basic Objects will commonly be referred to as Controls throughout the rest of this class.