Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: .NET
Expertise: Intermediate
Jun 16, 2017

Capture Errors from a BackGroundWorker Component in the RunWorkerCompleted Event

Background errors may not reach the main thread unless they are queried for.

One needs to use the Error Property of the RunWorkerCompletedEventArgs argument to determine if any errors have occurred during the DoWork of the BackGround Worker.

Excerpt below:

RunWorkerCompletedEventArgs e)
{
     bool result = false;
     //Check for errors when calling doWork service.
     if (e.Error != null)
     {
         //Handle errors on Background Worker explicitly here.
         HandleErrors(e);
         return;
     }
...
}
Srinath M S
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date