Results 1 to 2 of 2

Thread: Timer

  1. #1

    Thread Starter
    Banned
    Join Date
    Apr 2005
    Location
    C:\Documents And Settings\Dylan\Desktop
    Posts
    137

    Question Timer

    I need some help on a program that I'm planning to make. I need to use some kind of timer to perform a task every X minutes. First, I'll use the InputBox to ask how often to refresh. Then take the users variable and use
    VB Code:
    1. wWeb.Refresh
    to refresh the page every so often the user typed in the inputbox. Thank you for all your replies!

  2. #2
    PowerPoster
    Join Date
    Aug 2005
    Location
    College Station, TX
    Posts
    4,521

    Re: Timer

    heres a little something...

    VB Code:
    1. 'timer interval is 5000 here, which is 5 seconds
    2. Dim MyTimer as New System.Timers.Timer(5000)
    3.  
    4. 'In Form Load, add this
    5. AddHandler MyTimer.Elapsed, AddressOf TimerFired
    6.  
    7. 'Add this sub to handle the event
    8. 'Fires after each Timer interval, in this case, every 5 seconds
    9. Public Sub TimerFired(ByVal sender As Object, _
    10.       ByVal e As System.Timers.ElapsedEventArgs)
    11.  
    12.       wWeb.Refresh
    13.  
    14. End Sub
    15.  
    16. 'Remember to start the timer when you want with the following code...
    17. MyTimer.Enabled = True
    18. MyTimer.Start()
    19. 'To disable and stop the timer, change the enabled property
    20. MyTimer.Enabled = False

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