How to use the timer correctly?

Hi,
Im working on an VB.NET Application. Now I've got an Problem:

I want that the Browser "webbrowser1" reloads the Document every minute. But I don't know how to use the timer correctly. Could someone explain the component to me, please



Thanks

Fabian



Answer this question

How to use the timer correctly?

  • Wessam Bahnassi

    Thanks for the fast reply. I tried this code and it works correctly.


    Fabian


  • BrianNoyes

    Leshay,

    My whole point is that you don't need to drag a timer on. And I'm glad you got it!



  • unborracho

    It's pretty simple. I'd declare your timer as a member variable.

    Protected Friend WithEvents WBTimer as As New System.Windows.Forms.Timer

    Then when you want to initialize it, remember that its time unit is milliseconds. For a one minute interval:

    Wbtimer.Interval = 60*1000

    Wbtimer.enable= true

    WBtimer.start()

    But you aren't finished yet.......

    You need an event handler which is the business end of the timer:

    Private Sub WBTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles WBTimer.Tick

    ' Do your stuff here

    End Sub

    Enjoy !



  • Etheren

    Thanks, got my Timer working with your assistance.

    Once I discovered that I needed a Timer object draged onto my form it was easy



  • How to use the timer correctly?