-->

Saturday, May 14, 2016

Windows Forms Events

Windows Forms Events

An event is generated when a user performs an action, such as clicking the mouse or pressing a key. When a user clicks a form, the clicks event is generated for the form.
Each form and control has a predefined set of events associated with it. You can instruct an application to perform a specific action when an event takes place. For example, you can write code for adding items to a list as soon as a form is loaded.

Click : Occurs when a user clicks anywhere on a form.
DoubleClick : Occurs when the component is double-clicked.
FormClosed : Occurs when a form is closed.
Deactivate : Occurs when a form losses focus and is no longer active.
Load : Occurs when a form is loaded in the memory for the first time. This event can be used to initialize variables used in a form. This event can also be used to specify the initial values to be displayed in various controls in a form.
MouseMove : Occurs when a mouse is moved over a form.
MouseDown : Occurs when the left mouse button is pressed on a form.
MouseUp : Occurs when the mouse button is released.

You can specify the action to be performed on the occurrence of an event within a special method called, event handler. You can add code for an event handler by using the code Editor window.

To write code for an event corresponding to an object, open the properties window for that object.

Read other related articles

Also read other articles

© Copyright 2013 Computer Programming | All Right Reserved