Event Handling in Windows Forms
Visual Studio .NET 2003
An event handler is a procedure in your code that determines the actions to be performed when an event occurs, such as the user clicking a button or a message queue receiving a message. When an event is raised, the event handler (or handlers) that receives the event is executed. Events can be assigned to multiple handlers, and the methods that handle particular events can be changed dynamically. You can use the Windows Forms Designer to create event handlers.
In This Section
- Introduction to Events in Windows Forms
- Explains the event model and the role of delegates.
- Introduction to Event Handlers in Windows Forms
- Describes how to handle events.
- Creating Event Handlers on the Windows Forms Designer
- Gives directions for responding to system or user events.
- Creating Default Event Handlers on the Windows Forms Designer
- Gives directions for generating an event handler for the default event for a Windows Forms control.
- Creating Event Handlers at Run Time for Windows Forms
- Gives directions for responding to system or user events dynamically.
- Connecting Multiple Events to a Single Event Handler in Windows Forms
- Gives directions for assigning the same functionality to multiple controls through events.
- Creating Event Handlers in the Visual Basic Code Editor
- Gives directions for using the Visual Basic Code Editor to write code to respond to events.
- Mouse and Keyboard Events in Windows Forms
- Explains how to work with keyboard and mouse events raised by the user's interaction with Windows applications.
- Order of Events in Windows Forms
- Describes the order in which events are raised in Windows Forms controls.
- Determining Which Modifier Key Was Pressed
- Explains how to monitor events to look for modifier keys, such as the SHIFT, ALT, and CTRL, being pressed.
- Overriding Base Methods Using the Visual Basic Code Editor
- Gives directions for using the Visual Basic Code Editor to override methods defined in the base class.
Related Sections
- What's New in Windows Forms and Controls
- Describes the new features of Windows Forms and controls.
- Events and Delegates (Visual Basic)
- Provides links to Visual Basic-specific topics on using events.
- Events Tutorial (Visual C#)
- Demonstrates how to declare, raise, and handle events using Visual C#.
- Events Sample (Visual C#)
- Provides sample code demonstrating event handling with Visual C#.
- Event Implementation for Components and Custom Controls with Visual Basic (Visual Basic)
- Discusses implementing events and event handlers in custom controls and components with Visual Basic.
- Handling and Raising Events
- Provides links to topics on handling and raising events using the .NET Framework.
- Troubleshooting Inherited Event Handlers in Visual Basic .NET
- Lists common issues that arise with event handlers in inherited components.
- Events and Delegates
- Provides an overview of the event model and describes delegates in the .NET Framework.