Creating Runtime Event Handlers

You can define multiple responses to a single event. Like a symphony conductor orchestrating several musicians playing simultaneously, you can have a single event invoke multiple, orchestrated event handlers.

If you define more than one procedure with the same Handles clause, each procedure is called for a single event. For example, two separate procedures with Handles MyBase. Click clauses will each be invoked when the Click event occurs. This is related to the subject of multicast delegates (see Chapter 9). Suppose you have the Form1_Click event handler defined in Listing 8.8. If you defined a second procedure, arbitrarily named Form1_ClickToo with the Handles MyBase.Click clause, when Form1 was clicked, both ...

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