title: Button.Visible = true; fails to set the button to visible when activated within a function
body: <p>I haven't been able to find anyone else having this same problem, so hopefully someone might have some ideas or be able to point me to another answer.  </p>
  
  <p>When a function is run by pressing a button on the form, another button should become visible.  However, the button never shows up even though it is the first thing in the function.  All of the other code in the function works perfectly.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>private void trackbar_Change(object sender, EventArgs e)
  {
      button.Visible = true;
      progressbar.Visible = true;
  
      ...
  
      progressbar.Visible = false;
      button.Visible = false;
  }
  </code></pre>
  
  <p>The progress bar shows up and works fine, and all other code in the function works fine as well, but the button never shows up at all.</p>
  
  <p>If I remove <code>button.Visible = false;</code> from the end of the function, then the button DOES show up, but only after all other code has executed.  Like this:</p>
  
  <pre><code>private void trackbar_Change(object sender, EventArgs e)
  {
      button.Visible = true;
      progressbar.Visible = true;
  
      ...
  
      progressbar.Visible = false;
      //button.Visible = false;
  }
  </code></pre>
  
  <p>Commenting out that line causes the button to show up.  Now if I add a message box after the button line, then it also works.  </p>
  
  <pre><code>private void trackbar_Change(object sender, EventArgs e)
  {
      button.Visible = true;
      MessageBox.Show("Button should be visible now");
      progressbar.Visible = true;
  
      ...
  
      progressbar.Visible = false;
      button.Visible = false;
  }
  </code></pre>
  
  <p>Adding the message box after the button line caused the button to show up at the right time.</p>
  
  <p>Does anyone have any ideas why this button is behaving this way?  </p>