コード例 #1
0
        private void button8_Click(object sender, EventArgs e)
        {
            this.Hide();
            Add_Rubric_Level a = new Add_Rubric_Level();

            a.Show();
        }
コード例 #2
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Edit")
     {
         dash.rubLvlId = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
         this.Hide();
         Add_Rubric_Level addRubricLevel = new Add_Rubric_Level();
         addRubricLevel.Show();
     }
     if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Delete")
     {
         int rublvlId = 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)
         {
             SqlConnection connect = new SqlConnection(cnn);
             connect.Open();
             SqlCommand command = new SqlCommand("DELETE FROM RubricLevel WHERE Id  = '" + rublvlId + "'", connect);
             command.ExecuteNonQuery();
             connect.Close();
             this.rubricLevelTableAdapter.Fill(this.projectBDataSet1.RubricLevel);
         }
     }
 }