Chapter Eleven: Handling Events
Chapter Eleven: Handling Events
Chapter Eleven: Handling Events
Handling Events
1
Objectives
2
Objectives
3
Objectives
4
Understanding Delegates
5
Understanding Delegates
6
Creating Composed Delegates
7
Creating Composed Delegates
• Delegate3 Program
8
Creating Composed Delegates
10
Using the Built-in EventHandler
11
Handling Control Component Events
12
Handling Control Component Events
14
Using the IDE to Generate Event-Handling
Code
• It is possible (and easier) to create event-handling code
using the IDE
• The only difference between event-handling code
created by hand and the one you create using the IDE is
that the IDE automatically creates a lot of code for you
• The advantage of using the IDE is the time you save
typing and correcting typing errors
• The advantage of creating methods by hand is that you
understand what each statement accomplishes and are
able to customize methods to perform exactly the task
you want
15
Setting Controls’ Tab Order
16
Setting Controls’ Tab Order
18
Using the sender Object in an Event
21
Continuing to Explore C#
22
Chapter Summary
23
Chapter Summary
24
Chapter Summary
25