Timer problem

  • 13 years ago

    Hi.

     I have a small problem with a timer function.

    I need it to count down from a point like "08.00.00", and when it hits 0 it has to keep counting,

    but go into minus instead of counting up. Is there any way to solve this.

     Feigling

  • 13 years ago

    [quote user="Feigling86"]

     Is there any way to solve this.

    [/quote]

     You can try this.

    Treat each digits as a number and not as a timer value (h:m:s:) when the timer is set to 1seconds the digits are minus with 1

    display: H:M:S

     put the code below in the timer

    S=S-1

    if (S=0) then

        S=60

        if(M=0) then

            M=60

            H=H-1

        else

            M=M-1

         endif

    endif

    not sure if this is what you are looking for

  • 13 years ago

    A timer does not count.

    It fires events every so often.

    The interval does not really matter very much:

    Your code needs a        start_time       , and a      time_now   variable

    program starts, start_time is set to  Now() + 8 hours

    Display 08:00:00

    Start your timer.

    Every time the timer event triggers,   time_now = start_time - Now()

    Treating time_now as a double, you can divide it by 60, 60 etc to get the number of hours and minutes.

    Each time the timer fires, the number of hours will go down.

    Once it goes past 0, the code should still work and give you negatives. 

     

  • 13 years ago

    Thx to both of you, i will try and see if the solutions work.

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The generation of random numbers is too important to be left to chance.” - Robert R. Coveyou