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

The Archive Base Latest Questions

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

In my app I’ve got a thread which displays for some time please wait

  • 0

In my app I’ve got a thread which displays for some time ‘please wait’ dialog window, sometimes it is a very tiny amout of time and there is some glitch while drawing UI (I guess).

I get the exception ‘Thread was being aborted’ and completly have no idea how get rid of it. I mean Catch that exception in some way, or in some other way hide it from user. This exception has got nothing to do with rest of my app and that error in any way doesn’t affect it. Appears randomly and it is hard to recreate on a call.

I tried in various ways to catch that exception by side of code which starts and stops thread with dialog window but it seems that error apparently is by side some other thread which dispalys window in my newly created thread.

Here is a code sample, part of static class with useful stuff, of course I don’t say that is good way to solve this kind of ‘busy’ situation but I want to solve this problem. Thread.Sleep(500); or other try/catch improvments doesn’t help me to avoid that thread exception.

    public static bool alreadyBusy = false;     public static BusyIndicator bi = new BusyIndicator('');     public static Thread backgroundOpertionThread;      public static void showBusy(bool isBusy, System.Windows.Forms.Form hostform, string message)     {         Common.busyMessage = message;         if (isBusy)         {             Common.alreadyBusy = true;             backgroundOpertionThread = new Thread(new ThreadStart(showBusy));             Thread.Sleep(500);             if (hostform != null)             {                 hostform.Enabled = false;                 hostform.SuspendLayout();             }             backgroundOpertionThread.Start();          }         else         {              backgroundOpertionThread.Abort();             Thread.Sleep(500);             Common.alreadyBusy = false;             if (hostform != null)             {                 hostform.Enabled = true;                 hostform.ResumeLayout();             }         }     }      public static void showBusy()     {         BusyIndicator bir = new BusyIndicator(Common.busyMessage);         bir.ShowDialog();     } 

Any ideas?

  • 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. 2026-05-10T21:21:17+00:00Added an answer on May 10, 2026 at 9:21 pm

    Do not use Thread.Abort. This method is reserved for when the .NET runtime needs to forcibly kill threads in order to unload your program.

    You can only ‘safely’ use this if you’re about to unload an AppDomain and want to get rid of threads running in it first.

    To get rid of a thread, write it in cooperative mode. This means that the thread should periodically check some kind of flag, and if the flag is set, exit normally out of the thread method. To ‘kill’ the thread, simply set the flag and wait for the thread to exit.

    You can use an Event-object or a simple boolean variable for this flag.

    But do not use Thread.Abort.

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

Sidebar

Ask A Question

Stats

  • Questions 118k
  • Answers 118k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer LINQ defines an extension method that is perfect for solving… May 11, 2026 at 11:32 pm
  • Editorial Team
    Editorial Team added an answer You need to include the helpers reference; using NerdDinner.Helpers; and… May 11, 2026 at 11:32 pm
  • Editorial Team
    Editorial Team added an answer The answer by Ber - storing it in threadlocals -… May 11, 2026 at 11:32 pm

Related Questions

In my app i need to save changed values (old and new) when model
In my app I've got a thread which displays for some time please wait
In my app I have 2 divs, one with a long list of products
In my app I've got certain buttons which use the following code: SystemSoundID beep;
In my app i'm using quartz to schedule some jobs to run in my

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.