private void btnEdit_Click(object sender, EventArgs e) { connection connection = new connection(); switch (tabControl1.SelectedTab.Text) { case "Успеваемость": AddUsp AddUsp = new AddUsp(Convert.ToInt32(dataGridView2.Rows[dataGridView2.CurrentRow.Index].Cells[0].Value), ID_s); AddUsp.Show(); break; case "Посещаемость": AddPos AddPos = new AddPos(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value), ID_s); AddPos.Show(); break; } connection.Close(); }
private void button1_Click(object sender, EventArgs e) { connection connection = new connection(); switch (tabControl1.SelectedTab.Text) { case "Успеваемость": AddUsp AddUsp = new AddUsp(ID_s); AddUsp.Show(); break; case "Посещаемость": AddPos AddPos = new AddPos(ID_s); AddPos.Show(); break; } connection.Close(); }