Event Handling

Event handling is the process of reacting to events and is an important part of programming a user interface. An event is generated as the result of user actions, such as resizing a form, clicking the form, or moving the mouse over the form. An event also can be generated by changes in the environment, such as when a change in time occurs or when another application performs some action that affects the current application.

Two basic methods of event handling exist:

  • Attaching a delegate

  • Overriding a protected method of the base class

Attaching a Delegate

When a form is loaded, a Load event is raised. When you click the left or right buttons of a mouse, a MouseDown event is raised. Therefore, events enable a class to provide notifications ...

Get Developing and Implementing Windows®-Based Applications with Visual C#™ .NET and Visual Studio® .NET Exam Cram™ 2 (Exam 70-316) now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.