Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Private gStopTime As Date
Private WithEvents tmr As New Timer()
Private Const INTERVAL As Double = 25
Private Sub Form1_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
AddHandler Application.Idle, AddressOf UpdateClock
With tmr
.Interval = 1000
.Start()
End With
gStopTime = Now.AddSeconds(INTERVAL)
End Sub
Private Sub UpdateClock(ByVal sender As Object, ByVal e As EventArgs)
If Now >= gStopTime Then
End
Else
lblTime.Text = DateDiff(DateInterval.Second, _
gStopTime.AddSeconds(-INTERVAL), Now)
End If
End Sub
Private Sub tmr_Tick(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles tmr.Tick
Application.DoEvents()
End Sub
End Class