Results 1 to 7 of 7

Thread: Fire the function per 10 minutes in VB

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    8

    Thumbs up

    Hello Guys,

    I need some help in vb programming.

    I need to call a function in my application per 5 minutes
    (or some other period). How can I do that?

  2. #2
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    Use a timer control and a module variable

    I think from memory Timer controls will let you fire off an event every n milliseconds where 0 < n <= 60000. IN other words, one minute is the most you can get.

    So you simply have a module variable in your code or even a static var in your timer event to record how many lots of one minute have passed.

    Have you ever seen or used the timer control before?

    Regards
    Paul Lewis

  3. #3
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840
    Try this

    http://forums.vb-world.net/showthrea...threadid=20868

    This question has been asked lots of times, you should try a search of the forum!
    Paul Dwyer
    Network Engineer
    Aussie In Tokyo

    Using Powerbasic 6 & VB6 SP4 (Please also add your VB Version to your signature!)

  4. #4
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    Depends on what your program is designed to do...but you can use the sleep API.
    Code:
    Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
    
    
    'Then this will put the program to sleep for 5 minutes.
    Sleep 300000
    But if you want other things to continue on while the program waits the five minutes you would have to use a timer like Paul suggested.

    Gl,
    D!m
    Dim

  5. #5

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    8

    Wink How to use timer control

    I wnat other things to continue. So I prefer using the
    timer, like Paul suggested. But I never used timer control
    before, how to use it, and what is the module variable?

    Thanks a lot for your answer.

  6. #6
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    Follow the blue link

    not exactly alice in wonderland but if you follow the link that Paul Dwyer placed in his reply, you should see plenty of examples on how to solve your problem.

    Regards
    Paul Lewis

  7. #7

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    8

    Smile

    Yes,I got it.

    Thank you very much.

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