Adding and Removing Event Handlers

Visual Basic .NET extends event handlers by supporting the dynamic association of events at runtime. This means you can write code in such a way as to create controls and tie them to other controls without knowing what those controls will be in advance. The result is that you can dynamically customize your application after it has been compiled and shipped.

You might recall that the AddressOf operator in VB6 supported passing the address of a procedure to a Windows API procedure. The passed address of the procedure is referred to as a callback function. Windows and other languages have supported callbacks for many years. VB6 allowed callback functions to support Windows API methods that needed them, but you ...

Get Visual Basic® .NET Power Coding 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.