VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Timer Class Module

by James Arnold (1 Submission)
Category: VB function enhancement
Compatability: VB Script
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

This class module contains everything needed for creating a timer. It is very simple (18 lines), but provides millisecond accuracy using the GetTickCount API.

Assumes
To start the timer: MyTimer.StartTimer To stop the timer: MyTimer.StopTimer To read duration: MyTimer.ElapsedTime
Code Returns
Duration the timer has been running in milliseconds (divide by 1000 for seconds).
Side Effects
Due to the fact this is a class module the timer will continue to run even if a message box is displayed - the normal VB timer will pause when a messagebox is displayed. This can be an advantage or disadvantage, so take note.
API Declarations
Dim myTimer as timTimer
Set myTimer = New timTimer

Rate Timer Class Module

Download Timer Class Module

Download Timer Class Module (2 KB)

Timer Class Module Comments

No comments have been posted about Timer Class Module. Why not be the first to post a comment about Timer Class Module.

Post your comment

Subject:
Message:
0/1000 characters