Background worker

Posted on 2011-04-25
Last Modified: 2012-05-11
I have a background worker in my code, what I am trying to do is check at a scheduled time if the background worker is dead restart it
Question by:mannsingh3
    LVL 85

    Expert Comment

    by:Mike Tomlinson
    Why would your background worker be "dead"?...what are you doing in it?
    LVL 9

    Expert Comment

    Do you have the code that runs at scheduled time? If you have that all you need is to check IsBusy flag on the bg worker.

    If you need to restart the worker under specific conditions (e.g. stopped prematurely or threw exception), then you will need a lot more work.

    Author Comment

    can you shed some light what extra needs to be done if background worker needs to be started if stopped prematurely or threw an exception.
    LVL 9

    Accepted Solution

    1. Register for RunWorkerCompleted event.
    2. When the worker stops (work completed, gracefully cancelled, or terminated due to exception), the method is invoked. Check the Error property on RunWorkerCompletedEventArgs.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Normally a window is moved by clicking on the caption bar and dragging. You may want your user to be able to move borderless forms or move a form by clicking anywhere in the form without the limitation to the caption bar. There are many ways to do i…
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now