title: Dynamically removing/adding controls on a Windows Forms form
body: <p>I want to remove and add a control at runtime on a Windows Forms form. The problem is, that the control must have the exact same size, location and anchors as another one.</p>
  
  <p>If the user opens the window and a certain criteria is fulfilled, I want to delete the old control and replace it by another.</p>
  
  <p>So, I tried this:</p>
  
  <pre><code>RichTextBox InsideText = new RichTextBox();
  InsideText.Location = InsideBox.Location;
  InsideText.Size = InsideBox.Size;
  
  Controls.Remove(InsideBox);
  Controls.Add(InsideText);
  </code></pre>
  
  <p>But, as expected, it didn't work. The <code>InsideBox</code> is not removed and the <code>InsideText</code> not added.</p>
  
  <p>What am I doing wrong? Is there a better approach to this?</p>