|
-
Dec 11th, 2001, 10:57 AM
#1
Thread Starter
Addicted Member
Resolved:timer
Hi,
I'd like to call a Function in my App every 5 minutes. Does vb allow me to do so? How?
thanks,
-vb
Last edited by vbvbvbvb; Dec 11th, 2001 at 06:48 PM.
-
Dec 11th, 2001, 10:59 AM
#2
PowerPoster
You can do that with a timer control. A 60000 interval is one minute, so 5 minutes would be 300000. It's not completly accurate to the millisecond, but it's close.
-
Dec 11th, 2001, 11:17 AM
#3
Thread Starter
Addicted Member
-
Dec 11th, 2001, 12:25 PM
#4
Hyperactive Member
set the interval to 300000
like..
timer1.interval = 300000
and put ur code in
timer1_timer()
'ur code.....
end sub
-
Dec 11th, 2001, 01:58 PM
#5
Frenzied Member
A timer in Visual Basic can have a maximum interval of a value of an integer (65,536). You cannot set its interval to 300000
You'll need to use the API timer calls.
-
Dec 11th, 2001, 01:59 PM
#6
Frenzied Member
Or,
Set your timer to 60000 (1 minute).
Declare a public variable and increment it by 1 each time the timer event fires.
If the variable's value is 5, you know that 5 minutes have passed, then do your stuff and set the variable back to 0
-
Dec 11th, 2001, 02:25 PM
#7
Hyperactive Member
Use an IE timer, they have an interval of one second, so you can go to much longer times.
-
Dec 11th, 2001, 06:46 PM
#8
Thread Starter
Addicted Member
resolved
Private Sub Timer1_Timer()
Static numCalls As Long
Timer1.Interval = 1000000
numCalls = numCalls + 1
If numCalls = 2 Then
Call MySub
numCalls = 0
End If
End Sub
-
Dec 11th, 2001, 06:49 PM
#9
Banned
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|