private void button1_Click(object sender, EventArgs e) { Add_CLO d = new Add_CLO(); this.Hide(); d.Show(); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Edit") { Class1.id = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value); this.Hide(); Add_CLO registerStudent = new Add_CLO(); registerStudent.Show(); } if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Delete") { int clo_Id = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value); if (MessageBox.Show("Do you want to delete " + dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString() + "?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { con.Open(); SqlCommand cmd = new SqlCommand("DELETE FROM Rubric WHERE CloId = '" + clo_Id + "'", con); cmd.ExecuteNonQuery(); SqlCommand command = new SqlCommand("DELETE FROM Clo WHERE Id = '" + clo_Id + "'", con); command.ExecuteNonQuery(); con.Close(); this.cloTableAdapter.Fill(this.projectBDataSet.Clo); } } }