title: Why does the StatusBar.Invoke method not work for a ToolStripProgressBar?
body: <p>I have recently been working on an application where I wanted to display the progress of another thread in the status bar via the <code>ToolStripProgressBar</code> control that is contained in the <code>StatusBar</code> control. Before I attempted to add this code I originally had the code changing the text of a <code>ToolStripStatusLabel</code> control and to do this I used the Invoke method with delegates and everything worked fine. However, I found that when I attempted this with the <code>ToolStripProgressBar</code> the call to the status bar's <code>Invoke</code> method failed without a notification (no error, no exception, nothing). What I have since learned is that to use a progress bar in this way I had to use a <code>BackgroundWorker</code> control. So my code works but I don't understand why I couldn't use the <code>Invoke</code> method that already seemed to work.</p>
  
  <p>Some examples of what worked and what didn't:</p>
  
  <p>This worked</p>
  
  <pre><code> public delegate void changeStatusMessage(String message);
   public changeStatusMessage changeStatusMessageDelegate;
   public void changeStatusMessageMethod(String message){
        if(statusbar.InvokeRequired){
             statusbar.Invoke(changeStatusMessageDelegate, new Object[] {message});
        }else{
             toolstripLabel.Text = message;
        }
   }
  </code></pre>
  
  <p>This did not work</p>
  
  <pre><code> public delegate void incrementProgressBar(int value);
   public incrementProgressBar incrementProgressBarDelegate;
   public void incrementProgressBarMethod(int value){
        if(statusbar.InvokeRequired){
             statusbar.Invoke(incrementProgressBarDelegate, new Object[] {value});
        }else{
             toolstripProgress.Increment(value);
        }
   }
  </code></pre>
  
  <p>In the example that didn't work the <code>InvokeRequired</code> property is true so the <code>Invoke</code> method is called and then nothing happens. Where as I expected it to call the <code>incrementProgressBarMethod</code> again this time where <code>InvokeRequired</code> is false and thus allowing the <code>Increment</code> method to fire. </p>
  
  <p>I would really like to know why this doesn't work. As I said I have already retooled to use a <code>BackgroundWorker</code>, I just want an explanation.</p>