add 2 Labels Control and 1 Timer control and also a 3 command button for you Handle whether
you want to start,stop and reset
So this is the main code for you set up and get the output shown in the image above, i used
the very basic Nested IF structure
.
CODE:
Place at the Timer1_Tick Event
Dim Uno, Dos As Integer
Uno = "00"
Dos = "09"
If Val(Label2.Text) >= Uno And Val(Label2.Text) < Dos Then
Label2.Text = "0" & Val(Label2.Text) + 1
ElseIf Val(Label2.Text) = "59" Then
If Val(Label1.Text) >= Uno And Val(Label1.Text) < Dos Then
Label1.Text = "0" & Val(Label1.Text) + 1
Label2.Text = "00"
ElseIf Val(Label1.Text) = "11" And Val(Label2.Text) = "59" Then
Label1.Text = "00"
Label2.Text = "00"
Else
Label1.Text = Val(Label1.Text) + 1
End If
Else
Label2.Text = Val(Label2.Text) + 1
End If
Download sample
Happy Coding ^_^
The Hardest Thing to Do is to Do Nothing
Tags:
Timer,
Visual Basic 2010
Leave a comment