In this tutorial we'll be learning how to make a simple stopwatch.
-------------------------------------------------------------------
GUI (LAYOUT):
Here is my GUI:

------------------------------------------------------------------
WHAT YOU NEED:
2 Labels with:
#1 Label:
Name: Label1
Caption: SIMPLE STOPWATCH
#2 Label:
Name: Label2
Caption: 0.00
4 Command Buttons with:
#1 Command Button:
Name: Command1
Caption: START
#2 Command Button:
Name: Command2
Caption: STOP
#3 Command Button:
Name: Command3
Caption: RESET
#4 Command Button:
Name: Command4
Caption: QUIT
1 Timer with:
Name: Timer1
Caption: (None)
Interval: 1
----------------------------------------------------------------
CODE:
Quote
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Command3_Click()
Label2.Caption = "0.00"
End Sub
Private Sub Command4_Click()
End
End Sub
Private Sub Timer1_Timer()
Label2.Caption = Format(Val(Label2.Caption) + 0.01, _
"fixed")
End Sub
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Command3_Click()
Label2.Caption = "0.00"
End Sub
Private Sub Command4_Click()
End
End Sub
Private Sub Timer1_Timer()
Label2.Caption = Format(Val(Label2.Caption) + 0.01, _
"fixed")
End Sub
----------------------------------------------------------------
CODE EXPLANATION:
Quote
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Timer1.Enabled = True
End Sub
----------------------------------------------------------------
Quote
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Timer1.Enabled = False
End Sub
----------------------------------------------------------------
Quote
Private Sub Command3_Click()
Label2.Caption = "0.00"
End Sub
Label2.Caption = "0.00"
End Sub
----------------------------------------------------------------
Quote
Private Sub Command4_Click()
End
End Sub
End
End Sub
----------------------------------------------------------------
Quote
Private Sub Timer1_Timer()
Label2.Caption = Format(Val(Label2.Caption) + 0.01, _
"fixed")
End Sub
Label2.Caption = Format(Val(Label2.Caption) + 0.01, _
"fixed")
End Sub
----------------------------------------------------------------
Thank you for reading this tutorial.
Thanks to Tcm9669/TheComputerMaster for the Screenshot program.
Made by me, Travy92.
SAMPLES:


Sign In
Create Account




Back to top









