Hi, I'm getting quite good with vb.net now and have created quite a few good programs but I'm having trouble with something that seems simple but i cant figure out whats wrong, if anybody can help me with the following code it would be very appreciated.
What I'm trying to do is create a timer where you put in the time (in seconds) into textbox1 and when you click button2, label2.Text keeps decreasing by 1 each time timer2 has an interval, but for some reason, when i click start, it only goes down 1 and then just stops on that number.
Dim myTime As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Button1.Text = "Start" Then
myTime = TextBox1.Text
Label2.Text = myTime
Timer2.Start()
Button1.Text = "Stop"
Else
If Button1.Text = "Stop" Then
Timer2.Stop()
Button1.Text = "Start"
End If
End If
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Label2.Text = myTime - 1
End Sub
Private Sub Form8_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer2.Enabled = True
Timer2.Stop()
End Sub
Please help me solve this, thanks.