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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:29:56+00:00 2026-05-25T10:29:56+00:00

Why does the progress bar disappear when the style is changed from within a

  • 0

Why does the progress bar disappear when the style is changed from within a thread and how can I avoid having this happen?

I have a thread that runs for an indeterminate (but potentially lengthy) amount of time, so I wanted to use the progress bar to track the thread’s progress. I set the progress bar style to marquee before starting the thread to start, however once the thread finishes and sets the progress bar style back to blocks (which you can do from another thread by setting Form.CheckForIllegalCrossThreadCalls = false) the progress bar disappears from the form visually. Additionally, if I put a button on my form for the express purposes of changing the progress bar style back and forth, it will reappear, and change style back and forth as the button is pressed successively.

  • 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-25T10:29:56+00:00Added an answer on May 25, 2026 at 10:29 am

    Woah there! Stay the heck away from CheckForIllegalCrossThreadClass. That property, while Microsoft made it available and I’m sure there is a very, very, very rare (and I mean rare) use for it, don’t ever touch it. It will literally bring your software harm.

    You can use a simple ISyncronizeInvoke approach to update your UI, which I also wrote a blog post on (very simple one).

    /// <summary>
    /// Helper class that allows synchronized invoking to be performed in a single line of code.
    /// </summary>
    internal static class SynchronizedInvoke {
        /// <summary>
        /// Invokes the specified action on the thread that the specified sync object was created on.
        /// </summary>
        public static void Invoke(ISynchronizeInvoke sync, Action action) {
            if (!sync.InvokeRequired) {
                action();
            }
            else {
                object[] args = new object[] { };
                sync.Invoke(action, args);
            }
        }
    }
    

    The usage is easy.

    private void MyThreadWork() {
        // Do some work
        SynchnronizeInvoke.Invoke(uxProgressBar, () => uxProgressBar.Style = ProgressBarStyles.Blocks);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know of any methods to create a file upload progress bar in
Does Google force employees who have offers from Facebook to leave immediately?
Does anyone have any recommendations of tools that can be of assistance with moving
I'm trying to display an update progress loading image whenever my update panel does
Does the Java language have delegate features, similar to how C# has support for
Does anyone use have a good regex library that they like to use? Most
I've noticed that the bog-standard ProgressBar in .NET 2.0 (Winforms) does show up as
Does anyone remember the XMP tag? What was it used for and why was
Does anybody know any good resources for learning how to program CIL with in-depth
Does anyone know how to get IntelliSense to work reliably when working in C/C++

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.