O'Reilly logo

Visual Basic 2010 Unleashed by Alessandro Del Sole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Raising Events

You declare your own events utilizing the Event keyword. This keyword requires you to specify the event name and eventually a delegate signature. Although not mandatory (Event allows specifying no arguments), specifying a delegate signature is useful so that you can take advantage of AddHandler for subsequently intercepting events. The code in Listing 15.3 shows an alternative implementation of the Person class in which an event is raised each time the LastName property is modified.

Listing 15.3 Implementing and Raising Events

image

Notice that in this particular case you need to implement the LastName property the old-fashioned way, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required