private void tabControl1_Selected(object sender, TabControlEventArgs e) { foreach (Form WantToSelect in this.MdiChildren) { if (tabControl1.SelectedTab != null) //if no child has created, an error will occur { if (WantToSelect.Name == tabControl1.SelectedTab.Name) //again, this is why you must make sure child form's and tab page's name are same { //for easier control WantToSelect.Select(); //activate mdi child } } } }
private void tabControl1_Selected(object sender, TabControlEventArgs e) { foreach (liteForm WantToSelect in this.MdiChildren) { if (tabControl1.SelectedTab != null) { if (WantToSelect.Name == tabControl1.SelectedTab.Name) { WantToSelect.Select(); } } } }
private void SeleccionarSolapa(string nombreSolapa) { foreach (TabPage theTab in tabControl1.TabPages) { if (theTab.Text == nombreSolapa) { //when nemu is clicked, activate the corresponding form and tab page tabControl1.SelectTab(theTab); // when menu is clicked, select tab and activate mdi child foreach (Form WantToSelect in this.MdiChildren) { if (WantToSelect.Name == theTab.Name) //this is why you must make sure child form's and tab page's name are same { //for easier control WantToSelect.Select(); //activate mdi child } } } } }
private void menutab_Click(object sender, EventArgs e) { // throw new NotImplementedException(); foreach (TabPage theTab in tabControl1.TabPages) { if (theTab.Text == sender.ToString()) { tabControl1.SelectTab(theTab); foreach (Form WantToSelect in this.MdiChildren) { if (WantToSelect.Name == theTab.Name) { WantToSelect.Select(); } } } } }