Rick gave a short presentation in May 1999 for the Atlanta Visual Basic Study Group titled "The Dark Side of DoEvents." Thanks to Warren Bedell for a great title! Everything was done in Visual Basic 5.0, with Service Pack 3 (fine in version 6).


All versions

This Zip file includes all the project files, plus compiled EXE files for VB5 and VB6

Int Speed 1 Version 1 Version 1 - Intentionally "simple" user interface
Int Speed 2

Version 2

Version 2 - Improved using DoEvents. Also illustrates problems caused by DoEvents!

Int Speed 3A

Version 3A

Version 3A - Add code to disable and enable command buttons

Int Speed 3B

Version 3B

Version 3B - Improved using controls created "on the fly"

Int Speed 4

Version 4

Version 4 - More accurate timings via use of the Windows API: timeGetSystemTime

Timing Results

Version 4

Shows timings for the compiled code from version 4 of the project

Contents of DoEvents.ZIP:


File name



Int Speed 1.Vbp
Int Speed 1.Frm

Project file
Form file


Int Speed 2.Vbp
Int Speed 2.Frm

Project file
Form file


Int Speed 3A.Vbp
Int Speed 3A.Frm

Project file
Form file


Int Speed 3B.Vbp
Int Speed 3B.Frm

Project file
Form file


Int Speed 4.Vbp
Int Speed 4.Frm

Int Speed 4 VB5.exe
Int Speed 4 VB6.exe

Project file
Form file
Standard module which contains code for the Windows API calls to timeGetSystemTime
Compiled executable - requires Visual Basic 5.0 runtime library
Compiled executable - requires Visual Basic 6.0 runtime library

If you need the Visual Basic runtime libraries, you'll need to download the files from Microsoft's web site. See these Microsoft Knowledge base articles for more details:

ARTICLE-ID: Q180071     TITLE : FILE: Msvbvm50.exe Installs Visual basic 5.0 Run-Time files
ARTICLE-ID: Q192461     TITLE : FILE: VBRUN60.EXE Installs Visual basic 6.0 Run-Time files