Event Driven Programs Typically used for most modern day software applications examples include: word processing, spreadsheets, drawing packages etc. Usually used for GUIs where many types of events are generated i.e. clicking on a button or another object
Key features Event Handlers Trigger Functions Events Event Loops Forms Flexibility Service oriented Suitability for GUIs Simplicity of programming Time Driven
Event Handlers VB.Net uses subroutines for event handling, with the name of the object followed by the name of the event – see below: Event Event Handler
ByVal means it is passing the variable by value. sender is an object of type System.Object. All objects in .NET inheirit from System.Object, as such it is passing the control that is causing the event to fire. e is an object of type System.EventArgs where EventArgs is the Class for event arguments or, the arguments the event is passed. It contains information you need to process the event. The information available depends on the type of event that was raised. Since the members available through the "e" argument depend on the kind of action that raised the event, it is important to use an event that provides the information youre interested in.
Trigger functions These are used along with the object’s name to determine with event handler to run Every object has a range of trigger functions, one for each possible event that can happen to it. For example, txtText could have an event handler for the following triggers: GotFocus, TextChanged etc... Temporal triggers mean triggers set off by duration of time State triggers are when the current situation causes a certain set of procedures to run What is the trigger here??
Event Loops Event Driven Programs have event loops built into the environment. The loops keep testing the interface to detect whether anything has happened, such as clicking on a button or typing into a textbox etc. Event Loops are also known as event listeners
Flexibility Programmers have erroneous control over where to place code and how to start it. Every object has a good choice of events that a program can respond to. These events give an excellent level of control over exactly what the program will respond to when the user does something