I am currently making a timer for a school project. Im a little new to VB.net and having a few problems getting the timer to work.
When the countdown timer gets to 0 the "-" sign appears in the wrong place. As in i get 0:-1
I would also like the text in the timer to turn red when it enters negative numbers. (Maybe Flash, but i guess that is very complicated).
Anyway here is my current code:
Public Class Form1
Inherits System.Windows.Forms.Form
Dim TargetTime As System.DateTime
Dim willy As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
willy = TextBox1.Text
If Timer1.Enabled Then
Timer1.Stop()
Else
TargetTime = Now.AddMinutes(willy)
Timer1.Start()
End If
Catch ex As Exception
MsgBox("No Time Set")
End Try
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim Diff As TimeSpan = TargetTime.Subtract(Now)
Label1.Text = Diff.Minutes & ":" & Diff.Seconds
End Sub