Results 1 to 3 of 3

Thread: Need to make a timer!!!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Olavarría, Buenos Aires, Argentina
    Posts
    26
    Hi! I need to make a timer that counts in hours, minutes and seconds and not only pulses.
    Is there any way to do it??
    Thank You!!!!
    PandaNet!

  2. #2
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    this is what I would do:


    Code:
    Dim intTimer As Currency
    Private Sub Timer1_Timer()
    If intTimer = numberofseconds Then
    MsgBox "The time has been reached"
    Else:
    intTimer = intTimer + 1
    End If
    End Sub
    set the interval to 6000
    replace numberofseconds with the number of seconds that you want,
    1 minute = 60 seconds
    1 hour = 3600 seconds

    [Edited by dimava on 09-16-2000 at 11:09 PM]
    NXSupport - Your one-stop source for computer help

  3. #3
    Guest
    Try the following:
    Code:
    Private Declare Function GetTickCount Lib "kernel32" () As Long
    Dim StopTime As Boolean
    
    Sub TimerEx(Interval As Long)
    
        Do While StopTime = True
            Start = GetTickCount
            
            Do While Start + Interval > GetTickCount
                DoEvents
            Loop
            
            Print "1 Second"
        Loop
        
    End Sub
    Usage:
    Code:
    Private Sub Command1_Click()
        'Start the Timer at intervals of 1000ms (1 second)
        '1 min = 60000 and 1 hour = 3600000
        StopTime = True
        TimerEx 1000 
    End Sub
    
    Private Sub Command2_Click()
        'Stop the Timer
        StopTime = False
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width