Note that there are some explanatory texts on larger screens.

plurals
  1. POBackgroundWorker does not fire the RunWorkerCompleted event
    text
    copied!<p>I'm creating backgroundworker not in my windows form but in the class file (BusinessLogic) that implements all the processing. From main form I first call the BL method that initializes the BGW. Then I call the method of BL which will start the BGW. </p> <p>Here is more background :) on my implementation. <a href="https://stackoverflow.com/questions/6664246/how-to-use-backgroundworker-in-class-file">How to use BackGroundWorker in class file?</a></p> <p>The DoWork event runs fine but it doesnt call the RunWorkerCompleted. </p> <p>Some googling and I found out this link. I've a feeling that my problem is same as this guys. <a href="http://www.eggheadcafe.com/software/aspnet/29191764/backgroundworker-does-not-fire-the-runworkercompleted-event.aspx" rel="nofollow noreferrer">http://www.eggheadcafe.com/software/aspnet/29191764/backgroundworker-does-not-fire-the-runworkercompleted-event.aspx</a></p> <p>I'd appreciate any input on this issue. Thanks in advance.</p> <p>Code in Main form:</p> <pre><code> private void frmMain_Load(object sender, EventArgs e) { Hide(); BusinessLogic.BGWInitialize(); BusinessLogic.StartBackgroundWorker(); while (!BusinessLogic.firstCycleDone) { Thread.Sleep(100); } Show(); } </code></pre> <p>Code in BusinessLogic:</p> <pre><code> public static void BGWInitialize() { bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork); bgWorker.ProgressChanged += new ProgressChangedEventHandler(bgWorker_ProgressChanged); bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted); bgWorker.WorkerReportsProgress = true; } public static void StartBackgroundWorker() { bgWorker.RunWorkerAsync(); } private static void bgWorker_RunWorkerCompleted( object sender, RunWorkerCompletedEventArgs e) { firstCycleDone = true; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload