Events in Visual Basic
An event is a message sent by an object announcing that something has happened. Events are implemented using delegates, a form of object-oriented function pointer that allows a function to be invoked indirectly by way of a reference to the function.
In This Section
Events and Event Handlers
Provides an overview of events, event handlers, and associated terminology.WithEvents and the Handles Clause
Demonstrates how to use the WithEvents keyword and the Handles clause to associate an event with an event handler.AddHandler and RemoveHandler
Demonstrates how to use the AddHandler and RemoveHandler statements to dynamically associate an event with an event handler.How to: Add Events to a Class
Describes the process of defining events.How to: Create Event Handlers in the Visual Basic Code Editor
Gives directions for using the Visual Basic Code Editor to write code to respond to events.How to: Raise an Event (Visual Basic)
Demonstrates how to define an event and uses the RaiseEvent statement to cause the event to occurHow to: Create an Event and Handler (Visual Basic)
Demonstrates how to define an event and an event handler, and how to use the AddHandler statement to associate them.How to: Write Event Handlers
Demonstrates how to write event handlers using the Handles clause or the AddHandler statement.How to: Handle Events in Visual Basic
Defines a class that raises an event when you call the CauseEvent method.Walkthrough: Declaring and Raising Events
Provides a step-by-step description of how to declare and raise events for a class.Walkthrough: Handling Events
Demonstrates how to write an event-handler procedure.How to: Declare Events That Avoid Blocking
Demonstrates how to define a custom event that allows its event handlers to be called asynchronously.How to: Declare Events That Conserve Memory Use
Demonstrates how to define a custom event that uses memory only when the event is handled.Troubleshooting Inherited Event Handlers in Visual Basic
Lists common issues that arise with event handlers in inherited components.
Related Sections
Delegates in Visual Basic
Provides an overview of delegates in Visual Basic.Handling and Raising Events
Provides an overview of the event model in the .NET Framework.Creating Event Handlers in Windows Forms
Describes how to work with events associated with Windows Forms objects.