示例#1
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            Register_Student s = new Register_Student();

            this.Hide();
            s.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();
         Register_Student registerStudent = new Register_Student();
         registerStudent.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 Student WHERE Id  = '" + stdId + "'", con);
             command.ExecuteNonQuery();
             con.Close();
             this.studentTableAdapter.Fill(this.projectBDataSet.Student);
         }
     }
 }