Normally, you would expect to throw exceptions as usual, but due to the nature of how the worker handles exceptions; this is done a little differently...
The worker automatically handles exceptions and passes them as an argument to the RunWorkerCompleted event. From the developers perspective, you just need to throw them within the DoWork event.
In the RunWorkerCompleted event, the RunWorkerCompletedEventArgs object contains an "Error" property. Simply test for null here to know weather an error has occurred... here you can catch your exception!
No comments:
Post a Comment