private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 2) { ViewGroupStudents sdr = new ViewGroupStudents(); sdr.Id = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); sdr.Show(); } if (e.ColumnIndex == 3) { GroupEvaluation grp = new GroupEvaluation(); grp.Id = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); grp.Show(); } if (e.ColumnIndex == 4) { GroupProjects prg = new GroupProjects(); prg.Id = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()); prg.Show(); } if (e.ColumnIndex == 5) { conn.Open(); String cm4 = string.Format("Delete from GroupEvaluation where GroupId={0};Delete from GroupStudent where GroupId={0};Delete from GroupProject where GroupId={0};Delete from [Group] where Id={0}", Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString())); SqlCommand comm4 = new SqlCommand(cm4, conn); comm4.ExecuteNonQuery(); conn.Close(); MessageBox.Show("Deleted"); object sende = null; EventArgs er = null; dataGridView1.Rows.Clear(); this.Groups_Load(sende, er); } }
private void button4_Click(object sender, EventArgs e) { Form frm = new GroupProjects(); frm.Show(); }