title: C# Winforms - ProgressBar does not display and reset properly
body: <p>I have a windows desktop application that I am writing using Windows Forms in visual basic. In this app I would like to display a simple progress bar, but I have come across a strange issue. The below is an example of a simple for loop which updates the progress bar:</p>
  
  <pre><code>pBar.Visible = true;
  // pBar.Minimum and pBar.Step are both set to 1 using the properties pane in the design page
  pBar.Maximum = 100;
  for (int j = 0; j &lt; 100; j++) {
      double pow = Math.Pow(j, j); //Calculation
      pBar.PerformStep();
  }
  </code></pre>
  
  <p>The above works fine, however, I would like to be able to reset the progress bar to use it again later. I assumed I could simply set <code>pBar.Value = 1</code> after the for loop, but strangely this breaks the progress bar. Instead of incrementing steadily like it did previously, the bar does not fill at all. If I set <code>pBar.Value = 50</code>, the bar begins at the halfway point and does not move. It is behaving like <code>pBar.Value</code> is executing before the for loop, or that <code>pBar.Value</code> is getting set during each loop iteration (I've made sure that I did not mistakenly put the <code>pBar.Value</code> statement inside the for loop).</p>
  
  <p>The only reason I could think this is happening, is that C# is running my for loop asynchronously and the value is getting set immediately, then for some reason it isn't getting updated. I've tried looking around for answers to this, but so far all I have found are ways to create background workers (I'm not interested in that) and that my method of resetting the progress bar <em>should</em> be working...</p>
  
  <p>Why is this happening?</p>