コード例 #1
0
        private void btnAddRubricLevel_Click(object sender, EventArgs e)
        {
            this.Hide();
            AddRubricLevel addRubricLevel = new AddRubricLevel();

            addRubricLevel.Show();
        }
コード例 #2
0
 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();
         AddRubricLevel add_Rubric_Level = new AddRubricLevel();
         add_Rubric_Level.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 RubricLevel WHERE Id  = '" + stdId + "'", con);
             command.ExecuteNonQuery();
             con.Close();
             this.rubricLevelTableAdapter.Fill(this.projectBDataSet.RubricLevel);
         }
     }
 }