Creating Custom Events

Starting from Visual Basic 2005, you have the ability to define your own events implementing the custom events. They are useful because they provide a kind of relationship with a delegate. Generally custom events are also useful in multithreaded applications. You declare a custom event via the Custom Event keywords combination, supplying the event name and signature as follows:


IntelliSense is very cool here, because when you type the event declaration and press Enter, it adds a skeleton for the custom event that is constituted by three members: AddHandler is triggered when the caller subscribes for an event with the AddHandler ...

Get Visual Basic 2010 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.