title: Remove a TabPage
body: <p>I am using C# 2005 to create a Windows application. I have a MDIForm (frmMainMenu) which contains a Menustrip and a </p>
  
  <p>TabControl. My ChildForm is frmPurchaseEntry. When the user clicks on a particular Menu option a new TabPage is created and </p>
  
  <p>the child form is displayed within the TabPage.</p>
  
  <p>I am using the following code in the MenuClick event of the MDIForm (frmMainMenu) :</p>
  
  <pre><code>frmPurchaseEntry PurchaseEntry = new frmPurchaseEntry();
  PurchaseEntry.MdiParent = this;
  PurchaseEntry.TabCtrl = tabControl1;
  PurchaseEntry.TopLevel = false;
  PurchaseEntry.Visible = true;
  PurchaseEntry.FormBorderStyle = FormBorderStyle.None;
  PurchaseEntry.Dock = DockStyle.Fill;
  
  TabPage tpPurchaseEntry = new TabPage();
  tpPurchaseEntry.Parent = tabControl1;
  tpPurchaseEntry.Text = PurchaseEntry.Text;
  tpPurchaseEntry.Controls.Add(PurchaseEntry);
  
  tpPurchaseEntry.Show();
  PurchaseEntry.Select();
  
  tabControl1.SelectedTab = tpPurchaseEntry ;
  </code></pre>
  
  <p>Everything is OK upto this. But I am unable to remove the TabPage when the ChildForm is closed. The following command only </p>
  
  <p>closes the ChildForm, but the empty TabPage still remains.</p>
  
  <pre><code>this.Close();
  </code></pre>
  
  <p>I know the syntax to remove a TabPage is </p>
  
  <pre><code>tabControl1.TabPages.Remove(tabControl1.SelectedTab);
  </code></pre>
  
  <p>But Im unable to access the TabControl of MDIForm from the ChildForm. I tried to use Public modifier for the TabControl, but </p>
  
  <p>still it is not exposed from the ChildForm.</p>
  
  <p>How can I remove AND dispose a particular TabPage (with a particular Tab Text) from the ChildForm???</p>
  
  <p>Thank you.</p>
  
  <p>Lalit Kumar Barik</p>