hey guys so i made a timer that counts down from 15 to 0 ,
now i need a text displaying timer has finished on the aplication when
timer = "0" ,,, how to do? thanks
Printable View
hey guys so i made a timer that counts down from 15 to 0 ,
now i need a text displaying timer has finished on the aplication when
timer = "0" ,,, how to do? thanks
Declare module level variable and decrease it in Tick event and when it reach 0, display the message.
Something like this
vb Code:
Public Class Form1 Private mintCounter As Integer Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load mintCounter = 15 Timer1.Interval = 1000 ' one second Timer1.Enabled = True End Sub Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick mintCounter -= 1 Me.Text = mintCounter If mintCounter = 0 Then Timer1.Enabled = False MessageBox.Show("Timer has been finished") End If End Sub End Class