Results 1 to 9 of 9

Thread: Resolved:timer

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Location
    Florida
    Posts
    213

    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.

  2. #2
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    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.
    <removed by admin>

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Location
    Florida
    Posts
    213
    How? Some code please.

  4. #4
    Hyperactive Member deane034's Avatar
    Join Date
    May 2001
    Location
    Sri Lanka
    Posts
    485
    set the interval to 300000
    like..
    timer1.interval = 300000

    and put ur code in

    timer1_timer()
    'ur code.....

    end sub
    me.life = VB

  5. #5
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950
    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.

  6. #6
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950
    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

  7. #7
    Hyperactive Member Knowledge_is_Et's Avatar
    Join Date
    Dec 2001
    Location
    An Oak.
    Posts
    305
    Use an IE timer, they have an interval of one second, so you can go to much longer times.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Location
    Florida
    Posts
    213

    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

  9. #9
    Banned Motxopro's Avatar
    Join Date
    Dec 2001
    Posts
    57
    ok

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width