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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:05:33+00:00 2026-05-24T16:05:33+00:00

today I ran into a very interesting problem, which I was luckily able to

  • 0

today I ran into a very interesting problem, which I was luckily able to solve very quickly, however I’d like to know the nature of the problem.

I wrote a control class that manages joystick actions. I wanted to start some action and start the timer on button click and after the timer interval to stop this action.

I have a class(pseudocode) that looks like this :

public class Joystick : UserControl
{
  private Form.Timer timer; //or System.Threading.Timer
  public void Init()
  {
      timer.Tick += new EventHandler(timerCallback)   //Threading.Timer(timerCallback)
      timer.Stop();//timer.Change(Timeout.Infinite, Timeout.Infinite);
  }

   public void ButtonCallback()
   {
      StartSomething();
      timer.Stop();
      timer.Start(); //timer.Change(500, Timeout.Infinite); 
   }   

  public void timerCallback()
  {
     StopSomething();
     timer.Stop();//timer.Change(Timeout.Infinite, Timeout.Infinite);
  }
}

I have two applications, one is really simple (just a form), second one is more complex, however behind this complexity is still an ordinary Form (well DotNetMagicForm) containing this UserControl. Managing code is in both applications absolutely the same, but in the more complex application the timerCallback() was never called. In the simple one everything worked fine. The init was called in both cases (breakpoint). Even if I assign the timerCallback in the ButtonCallback – the timerCallback still wasn’t called.

I followed an advice of a colleague of mine and rewrote it by using Threading.Timer instead of Forms.Timer and suddenly it started working in both applications. Neither of us have a clue why it is.

I know my question is quite vague, but what could be the source of this issue?

Thanks

  • 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-24T16:05:35+00:00Added an answer on May 24, 2026 at 4:05 pm

    The Threading.Timer does not use a UI message pump to callback the tick. It uses a ThreadPool thread to do so.

    The UI timers simply post messages to the form’s message pump to solicit the callback. Your background magic form simply wasn’t receiving these messages. I’m never sure why though, perhaps because the form is on another thread without a message pump, or inactive forms don’t process the pump perhaps.

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

Sidebar

Related Questions

I ran into an interesting (and very frustrating) issue with the equals() method today
Today I ran into a very difficult TDD problem. I need to interact with
Today, I ran into this weird problem with a user using Mac OS X.
I ran into this situation today. I have an object which I'm testing for
Today I ran into a problem were I needed to remote-debug a program. The
Today I ran into a problem with the php function strpos() because it returned
I ran into an interesting issue today when I was working on an application
I ran into this block of code today, and I don't know how it
I ran into an interesting issue today. I have canvas elements that I am
So I ran into a problem today while working on my Android program. I

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.