Rick gave a presentation in December 1998 and January 1999 for the Atlanta Visual Basic Study Group on using Events with Class modules. Here are all the files, with additional documentation. There are numerous comments in the source code for each Visual Basic project. Everything was done in Visual Basic 5.0, with Service Pack 3.

I did something wrong when I previously set up the compiled version of the Event5_2 project. Even though I compiled both the in process and out of process ActiveX Servers, I did not compile the client side of the application. Unfortunately, when you run VB projects in the Visual Basic IDE, it forces you to have a single thread of execution. See below for the solution!



Events.ZIP EZ Download - This Zip includes all the other Zip files.
EventPPT.ZIP Zip file of Powerpoint slides, in MS PowerPoint 97 format.
MSIE.ZIP Powerpoint Slide: Client Side
This project has a reference to the Microsoft Internet Controls.You can change the variable declaration to include the word WithEvents. When you do that, the object itself will appear in the drop down list of objects at the upper left of the VB code window. Then you will see all the available events appear in the drop-down  list of events at the upper right of the VB code window.
Event4.ZIP Powerpoint Slide: Server Side
This project is basically Warren Bedell's original example of using Events with Class modules. It shows how the client (code in the VB Form) and the server (code in the Class module) can communicate. By declaring an instance of the Class module WithEvents in the Form, you can place code in its event routine. This code is executed each time that the Event is raised in the Class module. The event and its parameters are declared at the top of the Class module. The event is called with the RaiseEvent statement from within the Class module, which then executes the code in the Form module.
Timer.ZIP Powerpoint Slide: Timer API calls
This project is based on a White paper that Dan Appleman wrote called "It's About Time". This  discusses a disadvantage of VB's Timer control, which is that it may not fire when YOU want it to.
Callbck2.ZIP Powerpoint Slide: Timer API calls
This slide discusses the alternative to using VB's Timer control.  This project shows how to call the Windows API functions SetTimer and KillTimer to create your own timer object. This eliminates the need for a Form and a timer control in the Class module.
SimpCall.ZIP Powerpoint Slide: Callbacks versus Events
This project is an extremely oversimplified demonstration of how you can achieve the same functionality that Events provide by using Callbacks. I modified the project from Event4.vbp to pass a reference from the Form object to the Class module. Instead of declaring and raising an event in the class module, it invokes a method on the calling object.

Each of the links above allows you to download a ZIP file which contains the files for the presentation.


  Supplementary projects
We did not have time to go through several additional Visual Basic projects related to Events. The links below take you to separate pages for each Visual Basic project.
Event4_1 Multiple Objects - Example 1
Event4_2 Multiple Objects - Example 2
Event4_3 Multiple Objects - Example 3
Event5_1 Asynchronous Execution - Example 1
Event5_2 smallnew.gif (926 bytes)Asynchronous Execution - NOT!
Event5_3 smallnew.gif (926 bytes)Asynchronous Execution - YES!!