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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:17:21+00:00 2026-05-24T23:17:21+00:00

OK… Looks like WinForms and Threading in the same program is something that I

  • 0

OK…

Looks like WinForms and Threading in the same program is something that I can’t master easily.

I’m trying to make a custom Numeric Up Down out of two picture boxes (used a buttons) and a text box. Yes, I can use the default NumericUpDown form, but I want to make a different looking one.

I have tried to do that with timers (System.Windows.Forms.Timer). The problem is that when one timer meets “Thread.Sleep(int)”, the whole program “falls to sleep”.

I tried with threads. Some types of threads can’t control the UI. Then I tried this

private void declare_thread()
{
    //some work
    Thread delay = new Thread(new ThreadStart(delay0));
    delay.Start();
    //some more work
}
//other functions
private void delay0()
{
    //delay_for_500ms.WaitOne();
    this.Invoke((ThreadStart)delegate()
    {
    Thread.Sleep(500);
    if (is_mouse_down)
    timer1.Enabled = true;
    });
}

The result was the same as when I used timers only.

So, I want to make custom Numeric Up Down. But I can’t get it right. I know I’m doin’ it wrong. I want to make a thread that can control the UI and doesn’t make the whole program pause when calling “Thread.Sleep(int)”.

Please, give me answers for beginners. So far I haven’t found a good answer that can show me the right way and it’s easy to understand.

  • 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-24T23:17:22+00:00Added an answer on May 24, 2026 at 11:17 pm

    You’re looking for the wrong answer to the problem. There’s no such thing as a thread which can access UI controls and sleep without blocking the UI. Only the UI thread can access UI controls safely, and if you make the UI thread sleep, your UI will be unresponsive.

    I’m afraid you need to bite the bullet and learn how to perform the threading properly. Note that sleeping is almost always the wrong approach – especially in the UI thread. You ahven’t really said what you’re trying to do, but a timer is a good way of saying, “I want to perform some action at a later point in time.” There are various different timers in .NET – which one you should use will depend on what you’re trying to do.

    Threading is one of those topics that you can’t really shortcut – you should consider reading a thorough tutorial or a book which covers it in detail.

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

Sidebar

Related Questions

I have an element like this: <span class=tool_tip title=The full title>The ful&#8230;</span> This seems
CGI.escapeHTML is pretty bad, but CGI.unescapeHTML is completely borked. For example: require 'cgi' CGI.unescapeHTML('&#8230;')
I have this xml <entry id=1008 section=articles> <excerpt><p>&#8230; in Richtung „Aus für Tierversuche. Kosmetik-Fertigprodukte
An Arabic name shall be sent via SOAP. The name is encoded like this:
I see that some rss on xml have strange strings. For example, ... is
I'm trying to work out why it won't let me attach a file from
what about this one: I want to format the currentTime displayed by a videoPlayer
English is not my native language. I need a software to spellcheck and correct
I have been making a wordpress template. i got stuck at some place... the
I want to run this <!-- This will remove the tag --> <xsl:template name=remove-html>

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.