Timer countdown
unknown
plain_text
9 months ago
950 B
9
Indexable
Public Class Form1
Dim countdown As Integer = 5 * 60 'Amount of minutes in seconds
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
UpdateLabel()
Timer1.Interval = 1000 'This is equal to 1 sec
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If countdown > 0 Then
countdown -= 1
UpdateLabel()
Else
Timer1.Stop()
MessageBox.Show("STUPID CREATURE!")
End If
End Sub
Private Sub UpdateLabel()
Dim minutes As Integer = countdown \ 60
Dim seconds As Integer = countdown Mod 60
Label1.Text = minutes.ToString("00") & ":" & seconds.ToString("00") 'for proper minutes:seconds format
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Timer1.Start()
End Sub
End Class
Editor is loading...
Leave a Comment