public void newTab(DataRow[] rows, int i) { CadetTab newCadet = new CadetTab(rows, i); TabPage uTab = new TabPage(); uTab.Controls.Add(newCadet); uTab.Text = rows[i]["Name"].ToString(); tabView.TabPages.Add(uTab); tabView.SelectedTab = uTab; }
//This method creates a tab based on the row clicked and the userControl CadetTab public void newTab(DataGridViewRow rows) { CadetTab newCadet = new CadetTab(rows); TabPage uTab = new TabPage(); uTab.Controls.Add(newCadet);//This adds the newCadet controls to the uTab uTab.Text = rows.Cells["Name"].Value.ToString(); tabView.TabPages.Add(uTab); tabView.SelectedTab = uTab; }