Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7956081
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:53:20+00:00 2026-06-04T03:53:20+00:00

I Have This in C# private void counter_Tick(object sender, EventArgs e) { Time.Text =

  • 0

I Have This in C#

private void counter_Tick(object sender, EventArgs e)
    {
        Time.Text = String.Format("{0:000}", Hour) + ":" + String.Format("{0:00}", Minute) + ":" + String.Format("{0:00}", Second);
        if (Second != 00)
        {
            Second = Second - 1;
        }
        else if (Minute != 00)
        {
            Minute = Minute - 1;
            Second = 59;
        }
        else if (Hour != 00)
        {
            Hour = Hour - 1;
            Minute = 59;
        }
        else
        {
            counter.Stop();
            Time.ForeColor = Color.Red;
        }
    }

Which Does work but when it gets to minus an hour to add to minutes, it goes from 00 minutes to 58 minutes instead of 59

EG.

From: 001:00:00
To:   000:58:59

And is there a better way to make a countdown timer that does something when it hits 000:00:00???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:53:22+00:00Added an answer on June 4, 2026 at 3:53 am

    Well let’s see what happens when the time is 10:00:00.

    1. Subtract one hour: 09:00:00.
    2. Set minutes to 59: 09:59:00.

    If you notice the time is off by one minute (10:00:00 - 09:59:00 = 00:01:00). The solution is to set the seconds to 59 also. So now our code is.

    // ...
    else if (Hour != 00)
    {
        Hour = Hour - 1;
        Minute = 59;
        Second = 59;
    }
    // ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code private void writeReport(IReport report, string reportName) { string reportString =
I have this method to transfer files using a FTP Server: private void TransferNeededFiles(IEnumerable<string>
I have this interface: public interface IValidationCRUD { public ICRUDValidation IsValid(object obj); private void
I have this piece of code: private void myFunc(){ obj = doSomething(); //If value
I have this recursive method which deletes empty folders: private void DeleteEmpty(DirectoryInfo directory) {
I have this query where I am expecting a lot of results. private void
Right now, I have to do this private delegate void set(int obj); //declare the
I have this piece of code in c#: private static void _constructRow(SqlDataReader reader, system.IO.StreamWriter
I have the following simple function: private void EnableDisable941ScheduleBButton() { if (this._uosDepositorFrequency.Value != null)
I have a class like this public class foo { private void getThread() {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.