Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleDisplay the ellapsed time after a long operation
Keywordsellapsed time, Timer
CategoriesSoftware Engineering, Tips and Tricks
 
Use the Timer function to record the start and stop time. Subtract to see how many seconds have ellapsed.

This version only works for reasonably short durations where measuring in seconds is appropriate.

 
Private Sub cmdGo_Click()
Dim start_time As Single
Dim stop_time As Single
Dim i As Long
Dim max_value As Long

    lblEllapsed.Caption = ""
    max_value = CLng(txtCountTo.Text)
    Screen.MousePointer = vbHourglass
    DoEvents

    start_time = Timer

    For i = 1 To max_value
        ' Do nothing.
    Next i

    stop_time = Timer
    lblEllapsed = Format$(stop_time - start_time, "0.00") & _
        " seconds"

    Screen.MousePointer = vbDefault
End Sub
 
 
Copyright © 1997-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated