The Timer control allows you to set a time interval to execute an event after some interval continuously. It is useful when you want to execute certain applications after a certain interval.

Drag and drop Timer control from toolbox on the window Form.

Timer Control in VB.Net

Timer Control in VB.Net

Code:

Public Class Form22
 ' set Interval in Timer
    Private Sub Form22_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' after 1000 milisecond time will update
        Timer1.Interval = 1000
    End Sub
 
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        'current time will update coontinuesly
        Label1.Text = Now.ToLongTimeString.ToString()
    End Sub
End Class


Run the project 

Timer Control in VB.Net

Time will update continuously after every 1000 millisecond.

Timer Control in VB.Net

Timer properties

Interval:   Gets or sets the interval at which to raise the Elapsed event. 

Enabled:  Gets or sets a value indicating whether the Timer should raise the Elapsed event.  By default it set to false.

  Modified On Mar-22-2018 07:18:26 AM

Leave Comment