I am trying to make a timer and the code sometimes work and sometimes it doesnt

  • Thread starter Thread starter harvey21
  • Start date Start date
H

harvey21

Guest
Public Class Form1

Private Property Timer As Object

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Not IsNumeric(TextBox1.Text) Then
MsgBox("Please put in a number")
Else
Timer1.Enabled = True
Timer1.Interval = 1000
Time.text = TextBox1.Text
End If
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Timer.Text = 0 Then
Timer1.Enabled = False
MsgBox("time's up")
Else
TextBox1.Text = TextBox1.Text - 1

End If
End Sub



Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text = ""

End Sub



Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.Close()
End Sub

Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

End Sub
End Class

Continue reading...
 
Back
Top