Click to See Complete Forum and Search --> : timers


ma622
August 24th, 2001, 07:40 AM
i wanna to know how much it will take to do some loop....how can i put a timer for it?

Chris P
August 24th, 2001, 09:07 AM
You need to start the timer when the loop starts and end the timer when the loop stops and record it into a label control. I don't know how accurate you want to be but if you want it to be to the second then set the interval on the timer to 1000 and set the timers enabled property to false then...

Do while a <> b
timer1.enabled = true
loop

and under the timer put...

dim time, add
add = 1
time = label1.caption
label1.caption = time + add

* don't forget to make label1.caption = "0" before you start the timer. *


hope I could help. If you want to make it more accurate there is a topicon the forum that goes into further detail on timers.

Iouri
August 24th, 2001, 10:15 AM
Dim dS As Date 'start
Dim dF As Date 'finish
Dim vE As Variant'elapsed time

dS = Now()
dF = Now()
vE = Format$(dF - dS, "hh:mm:ss")
MsgBox vE

Iouri Boutchkine
iouri@hotsheet.com

deghost
August 25th, 2001, 02:34 PM
in a module declare

public Declare Function GetTickCount Lib "kernel32" () as Long



(or in a form)

private Declare Function GetTickCount Lib "kernel32" () as Long



and then in your sub do


Dim t as Long
...

t = GetTickCount
Do While a < 10000
...
Loop
t = GetTickCount - t 'This is in Milliseconds




----------
The @host is everywhere!
----------