public void addOutput(string fileLocation = "", string fileContents = "") { outputControl newOutControl = new outputControl(); TabPage newTab = new TabPage("Output " + (outputList.Count + 1)); newOutControl.tabClosed += () => onTabRemoved(newTab, newOutControl); newTab.Controls.Add(newOutControl); this.tabControl1.TabPages.Add(newTab); //this.tabControl1.Controls.Add(newOutControl); newOutControl.fileLocation = fileLocation; newOutControl.fileContents = fileContents; outputList.Add(newOutControl); }
public void onTabRemoved(TabPage closedTab, outputControl newControl) { this.tabControl1.TabPages.Remove(closedTab); outputList.Remove(newControl); }