private void btnEdit_Click(object sender, EventArgs e) { string name = comboBox1.Text; switch (name) { case "Школа": AddSchool AddSchool = new AddSchool(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value)); AddSchool.Show(); break; case "Ученик": AddStudent AddStudent = new AddStudent(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value)); AddStudent.Show(); break; case "Преподаватель": AddTeacher AddTeacher = new AddTeacher(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value)); AddTeacher.Show(); break; case "Предмет": AddDis AddDis = new AddDis(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value)); AddDis.Show(); break; case "Класс": AddClass AddClass = new AddClass(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value)); AddClass.Show(); break; } }
private void btnAdd_Click(object sender, EventArgs e) { string name = comboBox1.Text; switch (name) { case "Школа": AddSchool AddSchool = new AddSchool(); AddSchool.Show(); break; case "Ученик": AddStudent AddStudent = new AddStudent(); AddStudent.Show(); break; case "Преподаватель": AddTeacher AddTeacher = new AddTeacher(); AddTeacher.Show(); break; case "Предмет": AddDis AddDis = new AddDis(); AddDis.Show(); break; case "Класс": AddClass AddClass = new AddClass(); AddClass.Show(); break; } }