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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:33:02+00:00 2026-06-08T12:33:02+00:00

I want to show a new form with a progress bar marquee. This form

  • 0

I want to show a new form with a progress bar marquee. This form should be on an other thread, since the action that is called is too big and the UI doesn’t update the progress bar if it’s on the same thread.

I call a new thread, create my form, but as soon as it appears, the form close…

Here is my code from my main :

    frmProgress f = new frmProgress();
    Thread t = new Thread(new ThreadStart(delegate() { f.Show(); }));
    t.Start();
    documentManager.Compile(); //This is my big action
    t.Abort();

Here is the code of form :

    public frmProgress()
    {
        InitializeComponent();
    }

I would like to know what I did wrong.

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-06-08T12:33:04+00:00Added an answer on June 8, 2026 at 12:33 pm

    You have several problems:

    1. You’re showing a form in a non-UI thread. This will only cause problems; it needs to be in the UI thread.
    2. You’re performing a long running task in the UI thread; this is blocking UI updates.

    You need to be showing the forum in the UI thread, and running the long running task in a background thread.

    A great tool for the job here is to use a BackgroundWorker. It will do much of the work for you to ensure the proper code is running in the UI/non-UI threads as it should be. Create a new BackgroundWorker and put the long running task in the DoWork event. Make any simple UI updates that you need to (showing the form) before you start the BGW, and do any cleanup in the Completed event (which will run in the UI). The MSDN page on BackgroundWorker has some nice examples.

    Another advantage of using a BackgroundWorker is that you can easily report progress (if you have a good way of knowing your % complete) rather than just having a marquee bar. Just add a handler to the ProgressReported event handler to update the progress bar, and call the ReportProgress method periodically when doing work. See the linked examples for exact code snippets.

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

Sidebar

Related Questions

I am trying to create a thread that contains a form progress bar (just
I want to display a progress bar while doing some work, but that would
I often want to write something like this: new Form { Text = Caption,
I want to show progress bar while uploading a video from my app to
I want to show my data in grid view in my Asp.new c# form.
I am new to web development / php. I want to show an image
I new to Symfony. I want a piece of code only to show on
D6 Prof. Because of Z-Order problem I created a new form. I want to
I am displaying a new Form from one process by passing the Show method
** New EDIT ** so what I'm trying to do is this. I want

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.