Wednesday, February 25, 2009

The Form Events

The Form Events
As objects, forms can perform methods and respond to events.The Resize event of a form is occured whenever a form is resized, either by user interaction or through code. This allows you to perform actions such as moving or resizing controls on a form.
The Activate event occurs whenever a form becomes active form, the Deactivate event occurs when another form or application becomes active. These events are convenient for initializing or finalizing the form'sbehaviour.
OR For writing the code for any from use key combination Alt+V+C.
A form's events are shown below in the figure:
For Writing code of a particular event just click on a particular event ,then the following code window will appear:
Here for example you have clicked the MouseUp event.
Using the unload Event:
The unload event procedure is used to verify that the form should be unloaded.The unload event is occurred when:
1.The Form is unloaded using the Unload statement.
2.The form is closed by either clicking the Close command on the application menu or clicking the close button on application title bar.
Commonly used Form Events:
Activate Form_Activate event is triggered when form becomes the active window.
Click Form_Click event is triggered when user clicks on form.
DblClick Form_DblClick event is triggered when user double-clicks on form.
Load Form_Load event occurs when form is loaded.This is a good place to initialize variables and sets any run-time property.

No comments: