Chapter 12. Events and Delegates

A frequent design pattern in Windows programs is to write code that is triggered when a specific situation occurs (such as clicking a button) and then reacts to the event in some way. For example, when the menu item Exit is selected, the application might shut itself down, or when a button called Refresh is clicked, the application might refresh the data it is showing on the screen. This style of programming is called event-driven programming because the action in a program is driven by reacting to events. In event-driven programming, a type declares the events that it exposes. Then when an event occurs, the type raises the event and other types handle the event.

There are two ways of handling an event: declaratively ...

Get Visual Basic .NET Programming Language, The 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.