A possible solution is to change the way you get the result at the end. You could create a Result event. This way you could add a WaitFor in your activity after the call to the explorer to wait for the result. The DoEvents in the class would be no longer necessary.