So you need a timespan that represents the count down value. Then that value - the stopwatch elapsed equals how long remaining. That looks like this, without a check for expiration, which you should be able to figure out.
BTW - You and paul should check the difference in the string formats.Code:Dim sw As New Stopwatch Dim countdown As TimeSpan Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Dim ts As TimeSpan = countdown - sw.Elapsed Label1.Text = String.Format("{0:00}:{1:00}:{2:00}", ts.Hours, ts.Minutes, ts.Seconds) End Sub Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Button1.Enabled = False Timer1.Interval = 100 Timer1.Start() countdown = TimeSpan.FromMinutes(45) 'set the countdown sw.Start() End Sub




Reply With Quote
