Write one event handler to multiple objects in Visual Studio .NET and C#
This example will illustrate how to write one event handler to multiple objects. This example utilizes the checkbox objects. In the app, the user has an option to check up to four checkboxes. Each time he checks one, the total dollar value for each item the user is checking is displayed on a label.
An alternative would have been to place the code inside a button object. This would also provide the total in dollars for the checkboxes checked but not until the button was pressed. This application illustrates running totals based on check box clicks.
Two files are attached. A flash movie file illustrating the steps and a zip file containing the code. I recommend you oOpen the .swf file in a new window.
| Attachment | Size |
|---|---|
| oneEventHandler.zip | 31.48 KB |
| One-Event-Handler-To-Multiple-Objects.swf | 3.35 MB |