Chapter 8. Adding Events

Team-Fly    

 
Visual Basic .NET Unleashed
By Paul Kimmel
Table of Contents
Part II.  Advanced Object-Oriented Programming


In This Chapter

  • Understanding Events and Event Handlers

  • Creating Event Handlers in the Windows Form Designer

  • Creating Event Handlers in the Code Editor

  • Creating Runtime Event Handlers

  • Creating Event Handlers in the WebForms Designer

  • Declaring and Raising Events

  • Summary

Your programs receive feedback from users via events. Events are an important aspect of Windows programming. On the object-oriented side of the fence are classes that contain properties and methods . Without events, Windows applications would have no way to respond to external occurrences such as key presses and mouse clicks, or to repaint the screen. Events can be supported in structured languages, but all Windows programming languages need events to respond to inputs from users and from Windows.

Objects can work effectively without events but are better equipped to respond to inputs with events. For controls, like the Button component, events are essential because they provide the key to responsive behavior.

Methods, properties, and events form a triad of capability that makes object-oriented languages work effectively in an event-driven operating system such as Windows. Because events are important to effectively implement responsiveness in Windows applications, they have taken on greater significance in Visual Basic .NET than in VB6. Events are not new in Visual Basic .NET, but greater control over their use makes Visual Basic. NET a first-class language.

The event idiom has an enhanced role in Visual Basic .NET. This chapter demonstrates how you can effectively use events in all aspects of Windows programming, including an introduction to delegates. Chapter 9 complements Chapter 8 by providing thorough coverage of delegates, and Chapter 23 demonstrates using events in WebForms. In this chapter, you will learn about the new keywords and capabilities that are available as improvements in event programming in Visual Basic .NET.


Team-Fly    
Top
 


Visual BasicR. NET Unleashed
Visual BasicR. NET Unleashed
ISBN: N/A
EAN: N/A
Year: 2001
Pages: 222

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