title: C#: Wait until progressbar finished drawing
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1068720/winforms-progress-bar-does-not-update-c">Winforms Progress bar Does Not Update (C#)</a>  </p>
  </blockquote>
  
  
  
  <p>First time asking a question here for me.</p>
  
  <p>I'll try to explain my problem using this code snippet:</p>
  
  <pre><code>progressBar1.Maximum = 50;
  for (int i = 0; i &lt; 50; i++)
  {
      progressBar1.Value++;
  }
  MessageBox.Show("Finished");
  progressBar1.Value = 0;
  </code></pre>
  
  <p>The problem with this code is that the MessageBox pops up at the time the for loop is finished, <strong>not</strong> when the progressbar has finished drawing. Is there any way to wait until the progressbar has finished drawing before continuing?</p>
  
  <p>Thanks guys!</p>