Chapter 12. Events and Delegates

 <  Day Day Up  >  

A frequent design pattern in Windows programs is to write code that is triggered when a specific situation occurs (such as clicking a button) and then reacts to the event in some way. For example, when the menu item Exit is selected, the application might shut itself down, or when a button called Refresh is clicked, the application might refresh the data it is showing on the screen. This style of programming is called event-driven programming because the action in a program is driven by reacting to events. In event-driven programming, a type declares the events that it exposes. Then when an event occurs, the type raises the event and other types handle the event.

There are two ways of handling an event: declaratively and dynamically. Both are covered in this chapter.

 <  Day Day Up  >  


The Visual Basic .NET Programming Language
The Visual Basic .NET Programming Language
ISBN: 0321169514
EAN: 2147483647
Year: 2004
Pages: 173
Authors: Paul Vick

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net