
116
|
Chapter 8: Delegates and Events
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
' ----- First, try it in ascending order.
FlexSort(AddressOf SortAscending, dataValues)
For counter = 0 To 3
Debug.WriteLine(CStr(dataValues(counter)))
Next counter
Debug.WriteLine("")
' ----- Next, sort them again in descending order.
FlexSort(AddressOf SortDescending, dataValues)
For counter = 0 To 3
Debug.WriteLine(CStr(dataValues(counter)))
Next counter
End Sub
The output is:
2
4
6
9
9
6
4
2
Events and Event Binding
An event indicates some type of action. This action can be initiated by the user
(such as through a mouse click on a command button), by the application code
(such as when a change is made to a database record), or by the operating system
(such as a timer event). When any action like this occurs, it causes an event to be
raised or fired.
Each event has a source. This is the object to which the action is applied, such as
the button that was clicked. The source is responsible for alerting the operating
system that an event has occurred. It does so by sending an event notification
message. For this reason, the event source is often referred to as the sender.
An event often has an event argument, a means of conveying data that pertains to
the event. For instance, the press of a keyboard key generates an event that
includes event arguments describing ...