Beispiel #1
0
        private void button4_Click(object sender, EventArgs e)
        {
            this.Hide();
            Add_Assesment_Compomnent c = new Add_Assesment_Compomnent();

            c.Show();
        }
Beispiel #2
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Edit")
     {
         dash.assesCompId = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
         this.Hide();
         Add_Assesment_Compomnent addAssesmentComponent = new Add_Assesment_Compomnent();
         addAssesmentComponent.Show();
     }
     if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "Delete")
     {
         int assesCompID = 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 AssessmentComponent WHERE Id  = '" + assesCompID + "'", connect);
             command.ExecuteNonQuery();
             connect.Close();
             this.assessmentComponentTableAdapter.Fill(this.projectBDataSet1.AssessmentComponent);
         }
     }
 }