示例#1
0
        private void btnAddRubric_Click(object sender, EventArgs e)
        {
            this.Hide();
            AddAssessments addAssessments = new AddAssessments();

            addAssessments.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();
         AddAssessments registerStudent = new AddAssessments();
         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 AssessmentComponent WHERE Id  = '" + clo_Id + "'", con);
             cmd.ExecuteNonQuery();
             con.Close();
             this.assessmentComponentTableAdapter.Fill(this.projectBDataSet.AssessmentComponent);
         }
     }
 }