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 7041569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:03:42+00:00 2026-05-28T02:03:42+00:00

I have 2 timers. One of them is counting each time it ticks; while

  • 0

I have 2 timers. One of them is counting each time it ticks; while using steady interval, or one randomly generated. Second timer counts down to next tick in first timer.

As of right now I am doing as such:

    private void btnStart_Click(object sender, EventArgs e)
    {
        nextClick = int.Parse(nudClickInterval.Value.ToString());

        if (nudPlusMinus.Value != 0) tmrClickInterval.Interval = random.Next( int.Parse(nudClickInterval.Value.ToString()) - int.Parse(nudPlusMinus.Value.ToString()), int.Parse(nudClickInterval.Value.ToString()) + int.Parse(nudPlusMinus.Value.ToString()));
        else tmrClickInterval.Interval = int.Parse(nudClickInterval.Value.ToString());

        tmrClickInterval.Start();
    }

    private void tmrClickInterval_Tick(object sender, EventArgs e)
    {
        if (nudPlusMinus.Value == 0) tmrClickInterval.Interval = int.Parse(nudClickInterval.Value.ToString());
        else tmrClickInterval.Interval = random.Next(int.Parse(nudClickInterval.Value.ToString()) - int.Parse(nudPlusMinus.Value.ToString()), int.Parse(nudClickInterval.Value.ToString()) + int.Parse(nudPlusMinus.Value.ToString()));

        tmrNextClick.Interval = tmrClickInterval.Interval / 10;
        tmrNextClick.Start();
        content++;
        nextClick = tmrClickInterval.Interval;
        label1.Text = content.ToString();
    }

    private void tmrNextClick_Tick(object sender, EventArgs e)
    {
        if (nextClick <= 0) tmrNextClick.Stop();
        else
        {
            nextClick = nextClick - (tmrClickInterval.Interval / 10);
            lblNextClickCount.Text = (nextClick / 100).ToString();
        }
    }

I am setting up an interval of my count down timer by using first timer’s interval dividing by 10. The problem is that I keep getting some errors such as: Value '0' is not a valid value for Interval. Interval must be greater than 0. at line: tmrNextClick.Interval = tmrClickInterval.Interval / 10;.

I’m not sure how to avoid my errors so I figure there might be a better way of counting down time until next timer tick. Plus, I’d want a count down in nice steady interval instead but I am getting quite confused and not sure how to manage this problem.

Hope for some help.

  • 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-05-28T02:03:43+00:00Added an answer on May 28, 2026 at 2:03 am

    System.Windows.Forms.Timer has an int intervall. Dividing a number which is samller than 10 by 10 results in 0 (integer division!).

    Try to use System.Timers.Timer, it has an interval of type double, or check for 0 and assign 1 in that case.

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

Sidebar

Related Questions

I have two UpdatePanels and two Timers to update them, the Timers' interval are
I have cards in my web app that each one of them has a
I have this dilemma many times - and I would like one time and
If I have an instance of a System.Timers.Timer that has a long interval -
I have a pygtk Table with 16 squares, each of them containing a label.
I have just started learning ruby reading from different resources. One of them is
i have to function in two different files. one of them should add a
I have several subviews that are controlled by a navigation controller. One of them
I am using System.Timers.Timer class in one of the classes in my application. I
I have two click events, one of them has an ajax call, for the

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.