Programming with Events

Because .NET events are built on top of delegates, their underlying plumbing details differ dramatically from the way things used to work in previous versions of Visual Basic. Nevertheless, the designers of Visual Basic .NET did a good job in keeping the syntax for programming events consistent with earlier versions of Visual Basic. In many cases, programming events involves the same familiar Visual Basic syntax that you used in the past. For example, keywords such as Event, RaiseEvent, and WithEvents behave almost identically to the way their counterparts behaved in previous versions of Visual Basic.

Defining an Event

Let's start by creating a simple callback design based on an event. First, we need to define an event ...

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.