You are on page 1of 1

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.

Click
If stpw.IsRunning Then Exit Sub 'one at a time
countDown = New TimeSpan(0, 0, 10) '10 seconds
' countDown = #5/21/2016 2:00:00 AM# - #5/20/2016 10:00:00 AM#
stpw.Restart()
Timer1.Interval = 500
Timer1.Start()
End Sub

Private stpw As New Stopwatch


Private countDown As TimeSpan

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick


Dim timeremaining As TimeSpan = countDown - stpw.Elapsed
If timeremaining.TotalMilliseconds <= 0.0R Then
stpw.Stop()
Timer1.Stop()
Label1.Text = "END"
Else
Label1.Text = timeremaining.ToString
End If
End Sub

You might also like