title: Progress bar never displays
body: <p>I simply want a nondeterministic progressbar that becomes visible and shows some "activity" to indicate a query is running, and then, when the query is through, goes back to being invisible. Seems simple enough; but with this code:</p>
  
  <pre><code>try
  {
      Cursor.Current = Cursors.WaitCursor;
      progressBarChanges.Value = 50;
      progressBarChanges.Step = 20;
      progressBarChanges.Visible = true;
      ... // the meat of the code, where the query is being done, elided
  } finally
  {
      progressBarChanges.Visible = false;
      Cursor.Current = Cursors.Default;
  }
  </code></pre>
  
  <p>...the progress bar never displays, even though the query takes awhile to run. The progress bar is on a DGV. I realize my progress code is a bit lame, but first things first - I just want the darned thing to show <em>something</em> for starters.</p>
  
  <h2>UPDATE</h2>
  
  <p>I am setting the progressBar to visible <em>way</em> before I'm calling the BackgroundWorker proc that runs the query:</p>
  
  <pre><code>progressBarChanges.Value = 50;
  progressBarChanges.Step = 20;
  progressBarChanges.Visible = true;
  . . .    
  if (args.KeyCode == Keys.Enter)
  {
      if (ValidEntryForCRID(textBoxID.Text))
      {
          RetrieveAndBindPlatypusData();
          var tb = (TextBox)Controls.Find("textBoxDuckbill", true).First();
          if (tb != null)
          {
              tb.Focus(); 
          }
          if ((!string.IsNullOrWhiteSpace(textBoxID.Text)) &amp;&amp;
              (backgroundWorkerShowChanges.IsBusy != true))
          {
              backgroundWorkerShowChanges.RunWorkerAsync();
          }
      . . .
  </code></pre>
  
  <p>...yet the progressBar is never becoming visible (unless I never set it back to visible = false after the DGV's DataSource is assigned the OracleDateTable value of the returned query/result set). If I comment that out, it then (belatedly) finally shows up, apparently thinking (erroneously) "better late than never."</p>
  
  <p>Is there a way to force Windows to "pay attention" to the "progressBarChanges.Visible = true;" line right away? Something like a .ProcessMessages() or this.Refresh or...???</p>