|
|
Title | Display the ellapsed time after a long operation |
Keywords | ellapsed time, Timer |
Categories | Software 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
|
|
|
|
|
|