private void button1_Click(object sender, EventArgs e) { Add_Rubric jee = new Add_Rubric(); this.Hide(); jee.Show(); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Update") { updatesource.var = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value); this.Hide(); Add_Rubric add = new Add_Rubric(); add.Show(); } if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Delete") { int stdId = 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 command = new SqlCommand("DELETE FROM RUBRIC WHERE Id = '" + stdId + "'", con); command.ExecuteNonQuery(); con.Close(); this.rubricTableAdapter.Fill(this.projectBDataSet1.Rubric); } } }