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

  • SEARCH
  • Home
  • 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 8763921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:53:50+00:00 2026-06-13T15:53:50+00:00

I’m trying to make a countdown program, which I can start and stop and

  • 0

I’m trying to make a countdown program, which I can start and stop and set the value of the countdown to 10 minutes if needed.

But I’m getting an error I don’t quite understand.
I’m not that into C#, so here’s the code:

Can some one help me a bit here ? Think I run on framework 3.0 or something ?

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Timers;

namespace PauseMaster
{   
    public partial class MainForm : Form
    {           
        public MainForm()
        {           
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {               
        }

        private DateTime endTime;
        private void btnStartStop_Click(object sender, EventArgs e)
        {
            if(btnStartStop.Text == "START")
            {
                int hours = int.Parse(string.IsNullOrEmpty(txtCountFromHour.TextBox.Text) || txtCountFromHour.TextBox.Text == "timer" ? "0" : txtCountFromHour.TextBox.Text);
                int mins = int.Parse(string.IsNullOrEmpty(txtCountFromMin.TextBox.Text) || txtCountFromMin.TextBox.Text == "minutter" ? "0" : txtCountFromMin.TextBox.Text);
                int secs = int.Parse(string.IsNullOrEmpty(txtCountFromSec.TextBox.Text) || txtCountFromSec.TextBox.Text == "sekunder" ? "0" : txtCountFromSec.TextBox.Text);

                endTime = DateTime.Now.AddHours(hours).AddMinutes(mins).AddSeconds(secs);

                timer1.Enabled = true;  
                btnStartStop.Text = "STOP";
            }
            else
            {
                timer1.Enabled = false;
                btnStartStop.Text = "START";
            }
        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (endTime <= DateTime.Now)
            {
                timer1.Enabled = false;
                lblTimer.Text = "00:00:00";
                btnStartStop.Text = "Start";
                return;
            }

            TimeSpan ts = endTime - DateTime.Now;
            lblTimer.Text = string.Format("{0}:{1}:{2}.{3}", ts.Hours.AddZero(), ts.Minutes.AddZero(), ts.Seconds.AddZero());
        }

        public static class IntExt
        {
            public static string AddZero(this int i) // GETTING ERROR HERE AT 'AddZero'
            {
                int totLength = 2;
                int limit = (int)Math.Pow(10, totLength - 1);
                string zeroes = "";
                for (int j = 0; j < totLength - i.ToString().Length; j++)
                {
                    zeroes += "0";
                }
                return i < limit ? zeroes + i : i.ToString();
            }
        }     
    }       
}
  • 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-13T15:53:51+00:00Added an answer on June 13, 2026 at 3:53 pm

    The error message says exactly what’s wrong: your IntExt method isn’t a top-level static class. It’s a nested static class. Just pull it out of MainForm and it’ll be fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to select an H1 element which is the second-child in its group
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
Specifically, suppose I start with the string string =hello \'i am \' me And
I am trying to render a haml file in a javascript response like so:

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.