
Events and Event Binding | 117
Delegates and
Events
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
event argument class that doesn’t convey any specific argument data at all. Those
events that have actual event argument data to convey use for
e a class derived
from System.EventArgs instead.
Control-Related Events
In Windows Forms applications, controls are a veritable smorgasbord of built-in
events. For instance, the TextBox control has events associated with changing the
text in the TextBox, pressing a key while the TextBox has the focus, clicking or
double-clicking on the TextBox with the mouse, moving the mouse over the
TextBox, and more.
The Visual Studio IDE can insert an empty event handler for a control into your
source code, complete with the proper event parameters. Once you have added
the control to the form, access the source code related to the form. Just above the
source code editing area are two drop-down lists. The one to the left provides a
list of all controls placed on the form. The drop-down list to the right presents all
available events that correspond to the control or source selected in the left drop-
down list (Figure 8-1). To add a new event handler, select the control from the list
of controls, then select the desired event from the list of events.
Each control has a default event, such as the Click event for ...