private void btnaddclo_Click(object sender, EventArgs e) { this.Hide(); AddRubricLevel addnew = new AddRubricLevel(); addnew.Show(); }
private void clorecord_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (RubricLevelRecord.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Edit") { Class1.stuId = Convert.ToInt32(RubricLevelRecord.Rows[e.RowIndex].Cells[0].Value); this.Hide(); AddRubricLevel cl = new AddRubricLevel(); cl.Show(); } if (RubricLevelRecord.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Delete") { int rId = Convert.ToInt32(RubricLevelRecord.Rows[e.RowIndex].Cells[0].Value); if (MessageBox.Show("Are you sure to perform this action!?" + RubricLevelRecord.Rows[e.RowIndex].Cells[1].Value.ToString() + "?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { SqlConnection newconn = new SqlConnection(con); newconn.Open(); SqlCommand command = new SqlCommand("delete from RubricLevel where Id = '" + rId + "'", newconn); command.ExecuteNonQuery(); newconn.Close(); this.rubricLevelTableAdapter.Fill(this.projectBDataSet.RubricLevel); } } }