Handling Events Raised by the .NET Framework

At this point you should have a firm understanding of how events work. You should also be comfortable reading and writing code that uses both static event binding and dynamic event binding. This chapter concludes with practical examples of handling some of the common events raised by various frameworks within the .NET Framework Class Library.

The System.EventHandler Delegate

When you build applications using Windows Forms or ASP.NET, you will observe that a significant percentage of events you encounter are defined in terms of a generic delegate type named EventHandler. The EventHandler type exists in the System namespace and has the following definition:

 Public Delegate EventHandler(sender As Object, ...

Get Building Applications and Components with Visual Basic .NET 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.