Results 1 to 2 of 2

Thread: put a timer on this to close??

  1. #1

    Thread Starter
    Banned
    Join Date
    Sep 2004
    Location
    uk
    Posts
    34

    put a timer on this to close??

    is this correct

    Private Sub Form_Load()

    WebBrowser1.Navigate "http"
    Timer1.Interval = 30000

    End Sub

    i want it to load a website then after 5 mins close this app
    can anyone help

  2. #2
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: put a timer on this to close??

    The Interval property is the number of milliseconds. 30000 is 30 seconds. The max of the Interval property is roughly a minute. In order to execute code at 5 minute intervals you need to keep a counter to track the number of minutes that have elapsed.

    Code:
    Private Sub Form_Load()
      WebBrowser1.Navigate "http"
      Timer1.Interval = 60000 'fire the timer every minute
    End Sub
    
    Private Sub Timer1_Timer()
      Static lngMinutes as Long 
    
      lngMinutes = lngMinutes + 1
      If lngMinutes >=5 then
          Timer1.Enabled = False 
          Unload Me
      End if 
    End Sub

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