----------------------------------------------------------------
GUI (Layout)
Here's my GUI (layout):

----------------------------------------------------------------
What you need to add:
4 Command Buttons:
With the following names/captions:
#1 Command Button:
Name: cmdStart
Caption: Start Timer
#2 Command Button:
Name: cmdStop
Caption: Stop Timer
#3 Command Button:
Name: cmdClear
Caption: Clear Text
#4 Command Button:
Name: cmdExit
Caption: Exit
1 ListBox
With:
Name:lstCount
Caption: (None)
1 Timer
With:
Name: tmrTimer
Caption: (None)
----------------------------------------------------------------
CODE:
Add this code to General Declarations:
Quote
Dim Response As Integer
Dim mintCount As Integer
Dim mintCount As Integer
Quote
Private Sub cmdClear_Click()
lstCount.Clear
End Sub
Private Sub cmdExit_Click()
Response = MsgBox("Exit Program?", vbInformation + vbYesNo, "Are you sure?")
If Response = vbYes Then
Unload Me
ElseIf Response = vbNo Then
Me.Refresh
End If
End Sub
Private Sub cmdStart_Click()
mintCount = 0
Cls
tmrTimer.Enabled = True
End Sub
Private Sub cmdStop_Click()
tmrTimer.Enabled = False
End Sub
Private Sub tmrTimer_Timer()
mintCount = mintCount + 1
lstCount.AddItem "Timer fired again. Count = " & mintCount
End Sub
lstCount.Clear
End Sub
Private Sub cmdExit_Click()
Response = MsgBox("Exit Program?", vbInformation + vbYesNo, "Are you sure?")
If Response = vbYes Then
Unload Me
ElseIf Response = vbNo Then
Me.Refresh
End If
End Sub
Private Sub cmdStart_Click()
mintCount = 0
Cls
tmrTimer.Enabled = True
End Sub
Private Sub cmdStop_Click()
tmrTimer.Enabled = False
End Sub
Private Sub tmrTimer_Timer()
mintCount = mintCount + 1
lstCount.AddItem "Timer fired again. Count = " & mintCount
End Sub
CODE EXPLANATION:
Quote
Private Sub cmdClear_Click()
lstCount.Clear
End Sub
lstCount.Clear
End Sub
---------------------------------------------------------------
Quote
Private Sub cmdExit_Click()
Response = MsgBox("Exit Program?", vbInformation + vbYesNo, "Are you sure?")
If Response = vbYes Then
Unload Me
ElseIf Response = vbNo Then
Me.Refresh
End If
End Sub
Response = MsgBox("Exit Program?", vbInformation + vbYesNo, "Are you sure?")
If Response = vbYes Then
Unload Me
ElseIf Response = vbNo Then
Me.Refresh
End If
End Sub
----------------------------------------------------------------
Quote
Private Sub cmdStart_Click()
mintCount = 0
Cls
tmrTimer.Enabled = True
End Sub
mintCount = 0
Cls
tmrTimer.Enabled = True
End Sub
----------------------------------------------------------------
Quote
Private Sub cmdStop_Click()
tmrTimer.Enabled = False
End Sub
tmrTimer.Enabled = False
End Sub
----------------------------------------------------------------
Quote
Private Sub tmrTimer_Timer()
mintCount = mintCount + 1
lstCount.AddItem "Timer fired again. Count = " & mintCount
End Sub
mintCount = mintCount + 1
lstCount.AddItem "Timer fired again. Count = " & mintCount
End Sub
"mintCount" was dimmed as an integer in the "General declarations" section. With this said, the code means that every time the mintCount function is used, it adds +1 onto itself.
lstCount.AddItem "Timer fired again. Count = " & mintCount
Means that every time the mintCount is used, it adds the line "Timer fired again. Count = ?" Into the ListBox.
(The "?" means the number that the timer is up to)
----------------------------------------------------------------
Well this is the end of my Tutorial. Thanks for taking the time to read my tutorial.

This tutorial made completely by me, Travy92.
Special thanks the Tcm9669 for the screenshot program.
I've enclosed the sample:


Sign In
Create Account




Back to top









