title: How to move controls from one tab to another in C# winform program?
body: <p>I have a C# winform program that has many tabs, and I want to move controls between tabs. and code as below:</p>
  
  <pre><code>private void OnTabControlTabSelected(object sender , EventArgs e)
  {
      TabPage page = (sender as TabControl).SelectedTab;
      foreach(Control control in mLastSelectedTab.Controls)
      {
          this.mLastSelectedTab.Controls.Remove(control);
          page.Controls.Add(control);
      }
  }
  </code></pre>
  
  <p>I remove the control from the last selected tab and add it to the new selected tab, but the result is that some controls are added successfully, some are not, I set a breakpoint in this code, and found that the foreach loop doesn't loop through every control in the last selected tab. please help me to solve this problem, thank you!</p>