VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A simple timer that starts and stops incrementing seconds by use of a command button.

by Damien LeBlanc (1 Submission)
Category: Custom Controls/Forms/Menus
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Tue 27th February 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

A simple timer that starts and stops incrementing seconds by use of a command button.

API Declarations


'Feb. 27, 2001
'[email protected]
'example using Timer control to increment in seconds
'**********************************************************

'general declarations
Dim intSecond As Integer

Rate A simple timer that starts and stops incrementing seconds by use of a command button.




If Timer1.Enabled = True Then
    Timer1.Enabled = False
    cmdStartStop.Caption = "START THE TIMER"
    lblTimer.Caption = intSecond
Else: Timer1.Enabled = True
    cmdStartStop.Caption = "STOP THE TIMER"
End If

End Sub
    
Private Sub Timer1_Timer()
    'this code is executed with every interval of
    '1000 milliseconds or every one second
    
    If Timer1.Enabled = True Then
    lblTimer.Caption = intSecond
    intSecond = intSecond + 1 'increment the seconds
    End If
    
End Sub


Download this snippet    Add to My Saved Code

A simple timer that starts and stops incrementing seconds by use of a command button. Comments

No comments have been posted about A simple timer that starts and stops incrementing seconds by use of a command button.. Why not be the first to post a comment about A simple timer that starts and stops incrementing seconds by use of a command button..

Post your comment

Subject:
Message:
0/1000 characters