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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:33:00+00:00 2026-05-13T07:33:00+00:00

I have three seperate timers that call a method in each of their _Tick.

  • 0

I have three seperate timers that call a method in each of their _Tick. This method works fine, as intended, but within it is an if statement which checks to see if two values are either < or > than a number:

if ((x < y) || (x > z))
{

}

and within this statement, I want to stop those three times, show a message box and dispose the form. This is the code I’m using:

if ((x < yArray[0]) || (x > yArray[1]))
{
   frmFooBar barFoo = new frmFooBar();
   barFoo.tmrOne.Stop();
   barFoo.tmrTwo.Stop();
   barFoo.tmrThree.Stop();
   MessageBox.Show(GlobalVariables.aVariable+ " is dead.");
   barFoo.Dispose();
}

The conditional works fine, as when either statement is true, I’ll get a MessageBox popup every tick. The problem I’m having is that none of those form functions are working. tmrOne,Two keep running, and the form does not close.

I’m still new to C# so maybe my problem is obvious, but any help would be great! Thank you.

  • 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-13T07:33:00+00:00Added an answer on May 13, 2026 at 7:33 am

    You’re doing this in your method:

    frmFooBar barFoo = new frmFooBar(); 
    barFoo.tmrOne.Stop(); 
    barFoo.tmrTwo.Stop(); 
    

    This creates a new instance of frmFooBar, and has no effect on the instance that’s already running.

    If this is happening within the tick event of a timer on your form, you’ll want to use “this”, since that will be the currently running form:

    this.tmrOne.Stop();
    this.tmrTwo.Stop();
    

    That way, you’re stopping the timers on the currently running form.

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

Sidebar

Related Questions

I have a table which needs to link one of three seperate tables, but
I am aware that System.Threading.Timer exists, but I already have a Thread. This thread
We have a GUI of several frames that build their contents dynamically. Each frame
I have a Util package with source files in three seperate directories, defined like
Say I have three separate color schemes that are used on various pages in
I have a .aspx page that loads three separate .ascx controls to represent adding,
I have the simplest code that I want to separate in three files: Header
Have three divs in a container that I want to float over a large
i have three lists with the same number of elements in each other, i
I am using this JQuery autocomplete plugin . It works, and it's simple. But

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.