background worker cancel problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Smokey Grindel

    #1

    background worker cancel problem

    I have a search function that runs in a background worker which can run
    long.. I want the user to be able to cancel that then run another search...
    but sometimes it throws an exception saying

    System.InvalidO perationExcepti on: This BackgroundWorke r is currently busy
    and cannot run multiple tasks concurrently.

    What I did before the search button was pressed again was check if the
    worker is busy and if it is cancel the current search then start another...
    now how can i make sure the worker isnt workering before trying to start
    another? Even though I cancelled the work some work might still be
    processing before it realizes its cancelled and thats what seems to be
    causing the error... thanks!


Working...