title: Can't make form 'close itself'?
body: <p>I have one form that opens another form upon clicking a button. When the new form opens, I have a progress bar complete via a loop, then I want the form to close. Here is the button click event that launches the new form.</p>
  
  <pre><code>    private void calculateButton_Click(object sender, EventArgs e)
      {
  
          if (checkFormComplete())
          {
              ProgressForm proForm = new ProgressForm();
              proForm.Show();
          }
  
      }
  </code></pre>
  
  <p>And here is the code for the new form that completes a progress bar that should then close itself.</p>
  
  <pre><code>    public ProgressForm()
      {
          InitializeComponent();
          for (int i = 0; i &lt; 101; i++)
              calculationProgress.Value = i;
  
          this.Close();
      }
  </code></pre>
  
  <p>However, upon running this I get:</p>
  
  <blockquote>
    <p>Cannot access a disposed object. Object name: 'ProgressForm'.</p>
  </blockquote>
  
  <p>And the debugger points to this line of my main form:</p>
  
  <pre><code>proForm.Show();
  </code></pre>
  
  <p><strong>I'm not sure I understand why, or what the proper way to do this is. How is that line being called after the close statement inside my new form?</strong></p>