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 ;
this.Close();
tabControl1.TabPages.Remove(tabControl1.SelectedTab);