I want to create a running 'stopwatch' for my game program. the 'stopwatch' time should be shown in a label box. It should be function like "microsoft Minesweeper Game" timer.
Printable View
I want to create a running 'stopwatch' for my game program. the 'stopwatch' time should be shown in a label box. It should be function like "microsoft Minesweeper Game" timer.
put a timer control on your form, set its interval to 1000(milliseconds) set its enabled to false.
Then
private Sub Command1_Click()
Timer1.Enabled = true
End Sub
private Sub Timer1_Timer()
static cnt as Integer
cnt = cnt + 1
Label1.Caption = cnt
End Sub
You cannot make the timer tick more rapidly than once per 55 ms.
how do i disable the stopwatch timer with the same command button?
private Sub Command1_Click()
Timer1.Enabled = Not Timer1.Enabled
End Sub