Q:

progress bar and ThreadAbortException

I have 2 forms. The main form with some code and the 2 form that has progress bar. While main form is working it became invisible and the second form as a thread apears:         
 Thread pb = new Thread(Show_pb); //Show_pb shows the 2 form with green progress bar
 pb.Start();
 this.ShowInTaskbar = false;
 this.Visible = false;

 //do smth...

  pb.Abort();        
  this.Visible = true;
  this.ShowInTaskbar = true;
  this.Activate();

After all sometimes it throws an exception: 

Thread was being aborted

If I create try..catchin the Show_pb it will throw it everytime:
    try
    {
        Form2 f_pb = new Form2();
        f_pb.ShowDialog();
        f_pb.Activate();
    }
    catch (Exception ex)
    {
        throw ex;
    }

But I can't handle the exception that system throws. What should I change or how to handle this exception?

A:

See the documentation on ThreadAbortException Class:

When a call is made to the Abort method to destroy a thread, the
  common language runtime throws a ThreadAbortException.
  ThreadAbortException is a special exception that can be caught, but it
  will automatically be raised again at the end of the catch block.

You can't effectively catch this exception.
The first thing is that you shouldn't ever call Thread.Abort unless your whole app is shutting down. It can also leave your app in an unknown state.
The next thing is that it seems that you are starting some UI in a non-UI thread. That's bad. You really shouldn't be doing that either.
The correct approach is to run your computation in a background thread and marshal the updates back to the UI to update your progress bar.

