title: Adding and removing groupboxes dynamically
body: <p>I have a form containing two buttons.</p>
  
  <p>The first one adds some <code>GroupBoxes</code> to the form, with this handler:</p>
  
  <pre><code>private void btnAdd_Click(object sender, EventArgs e)
  {
      GroupBox[] g_arr = new GroupBox[2];
      for (int i = 0; i &lt; g_arr.Length; i++)
      {
          g_arr[i] = new GroupBox();
          g_arr[i].Location = new Point(280, (i*-50) + 300);
          g_arr[i].Size = new Size(337, 380);
  
          this.Controls.Add(g_arr[i]);
              }
          }
  </code></pre>
  
  <p>The second one is supposed to remove every <code>GroupBoxes</code> inside the form, <strong>but not all of them disappear when it's clicked</strong>:</p>
  
  <pre><code>private void btnDelete_Click(object sender, EventArgs e)
  {
      foreach (Control c in this.Controls)
      {
          if (c is GroupBox)
          {
              this.Controls.Remove(c);
          }                    
      }
  }
  </code></pre>
  
  <p>Why doesn't my remove button manage to remove every <code>GroupBox</code>?</p>