This is the very basic way on how you to create your own count down timer using timer
Control on your Visual Basic Project just add 1 Label,1 Command button,and also a timer
control,at label caption property make it 15,then at the timer control property under
Enabled=False,and Interval=1000 which is equivalent to 1 seconds,then under command
button clivk event place this code below
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
and at the timer timer event
Private Sub Timer1_Timer()
Label1.Caption = Label1.Caption - 1
If Val(Label1.Caption) = 0 Then
MsgBox "Its Time"
Timer1.Enabled = False
Label1.Caption = 15
Exit Sub
End If
End Sub
on the if statement ill trap the value of label if is equal to 0 then it will prompt
the message then it will reset
Counting State
reach the 0 value
The Hardest Thing to Do is to Do Nothing
Happy Coding (^_^)
Control on your Visual Basic Project just add 1 Label,1 Command button,and also a timer
control,at label caption property make it 15,then at the timer control property under
Enabled=False,and Interval=1000 which is equivalent to 1 seconds,then under command
button clivk event place this code below
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
and at the timer timer event
Private Sub Timer1_Timer()
Label1.Caption = Label1.Caption - 1
If Val(Label1.Caption) = 0 Then
MsgBox "Its Time"
Timer1.Enabled = False
Label1.Caption = 15
Exit Sub
End If
End Sub
on the if statement ill trap the value of label if is equal to 0 then it will prompt
the message then it will reset
Counting State
reach the 0 value
The Hardest Thing to Do is to Do Nothing
Happy Coding (^_^)
Leave a comment