I am showing a splash screen on a background thread while my program loads. Once it loads I am aborting the Thread as it’s only purpose was to show a Now Loading splash form.
My problem is that when aborting a Thread it throws a ThreadAbortException that the user can just click Continue on.
How do I deal with this? I was trying to suppress it like so –>
try
{
Program.splashThread.Abort();
}
catch(Exception ex)
{
}
but I have a feeling that is going to get me yelled at here and it doesn’t work any way.
Thanks!
You don’t need to cancel the thread. I’ll exemplify with code.
In the splash screen form:
In the Program.cs file:
Now, when your Main method starts, show the splash in a thread:
…and when you want it to close, just close it:
Then you don’t need to worry about aborting the thread; it will exit gracefully.