Results 1 to 8 of 8

Thread: COUNTER!!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Olavarría, Buenos Aires, Argentina
    Posts
    26
    Hi! I need to make a counter that doesn't use the clock time.
    And I need that when it gets to 60 seconds, it starts like 00:01:00, and when it gets to 60 minutes, it gets 01:00:00, and so on, like a real clock.
    Is it clear??
    Thank you!!
    PandaNet!

  2. #2
    Guest
    Is this what you want?

    Code:
    Private Sub Command1_Click()
    
         Time = "00:00:00"
         Do
         Label1.Caption = Format(Time, "hh:nn:ss")
         DoEvents
         Loop
    
    End Sub

  3. #3
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    and what is wrong with the example given?
    It does what you want does it not?
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

  4. #4
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Maybe you could use timeserial function
    Code:
    static n&
    timeserial(0,0,n)
    n=n+1
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  5. #5
    Guest



    It starts from 00:00:00 and goes up:

    00:00:01
    00:00:02
    00:00:03
    00:00:04
    00:00:05
    00:00:06
    00:00:07
    00:00:08
    00:00:09
    00:00:10
    '^seconds
    ....
    00:01:00
    00:02:00
    00:03:00
    00:04:00
    00:05:00
    00:06:00
    00:07:00
    00:08:00
    00:09:00
    00:10:00
    '^minutes
    01:00:00
    02:00:00
    03:00:00
    04:00:00
    05:00:00
    06:00:00
    07:00:00
    08:00:00
    09:00:00
    10:00:00
    '^hours

    Is that not what you wanted?


    Kids these days, back in my day...we took what we were given, no questions asked .

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Olavarría, Buenos Aires, Argentina
    Posts
    26

    Here I am again

    Ok. It does, in part, what I need: it counts like that, but it modifies the CPU time, and I don't want it.
    I need it to count, like it does but not using or modifying in any way, the CPU time. Am I clear? I hope so. I know my english may not be so clear as I'd like, but...
    Thank You!!
    PandaNet!

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    put my code in a timer with interval set to 1000
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  8. #8
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Talking Is this what you are looking for?....

    Here it is the old-fashoined way... Put a label and a timer on a form and paste the following code into the form's code window. (Use the default names for the controls).

    This should give you the functionality that you are looking for without using the system time, Time function, or any other intrinsic "stuff"...
    Code:
    Option Explicit
    
    Private Sub Form_Load()
        Label1 = "00:00:00"
        Timer1.Interval = 1000
    End Sub
    
    Private Sub Timer1_Timer()
        Static intSecond As Integer
        Static intMinute As Integer
        Static intHour As Integer
        
        intSecond = intSecond + 1
        
        If intSecond = 60 Then
            intSecond = 0
            intMinute = intMinute + 1
        End If
        
        If intMinute = 60 Then
            intMinute = 0
            intHour = intHour + 1
        End If
        
        If intHour = 13 Then intHour = 1
        
        DisplayTime intHour, intMinute, intSecond
    End Sub
    
    Private Sub DisplayTime(intHour As Integer, intMinute As Integer, intSecond As Integer)
        Dim strTime As String
        
        If intHour < 10 Then strTime = strTime & "0"
        
        strTime = strTime & intHour & ":"
        
        If intMinute < 10 Then strTime = strTime & "0"
        
        strTime = strTime & intMinute & ":"
        
        If intSecond < 10 Then strTime = strTime & "0"
        
        strTime = strTime & intSecond
        
        Label1 = strTime
    End Sub
    Hope that helps!

    [Edited by seaweed on 11-08-2000 at 01:37 AM]
    ~seaweed

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