Delegates are multicastwhich means that they can hold references to more than one event-handling method. If your class defines many events that are infrequently raised, you will want to implement event properties. For this code to work, you need to use the designer to hook up the events, which generates the following line of code in the designer file or add this line of code in the form:. Define the class that inherits from EventArgs. Then the class module dropdowns give all the events for that object, I select what I want, voila. This procedure declaration is followed by Handles Button2.
How to: Call an Event Handler in Visual Basic
Delegates provide flexibility and fine-grained control in event handling. Exit focus mode. For details, see the Delegate reference page. You determine which event data class is associated with an event by looking at the delegate for the event. You mark a delegate with the C delegate and Visual Basic Delegate keyword in the declaration.