Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Class Form1
- Private WithEvents clockTimer As New Timer
- Private currentTime As DateTime = DateTime.MinValue
- Private Sub ClockTick(ByVal sender As Object, _
- ByVal e As System.EventArgs) Handles clockTimer.Tick
- UpdateTimer()
- DisplayTimer()
- End Sub
- Private Sub UpdateTimer()
- currentTime = DateTime.Now
- clockTimer.Stop()
- clockTimer.Interval = 1000 - currentTime.Millisecond
- clockTimer.Start()
- End Sub
- Private Sub DisplayTimer()
- lblTime.Text = currentTime.ToString("T")
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, _
- ByVal e As System.EventArgs) Handles MyBase.Load
- UpdateTimer()
- DisplayTimer()
- End Sub
- End Class
Add Comment
Please, Sign In to add comment