private void btnDelete_Click(object sender, EventArgs e) { SqlConnection conn; conn = DB.getinstance(); conn.Open(); ClsPatient patient = new ClsPatient(); patient.Patient_Id = Convert.ToInt32(txtDelete.Text); try { patient.delet(); MessageBox.Show("Patient deleted succesffully."); dataGridView2.DataSource = null; dataGridView1.DataSource = new ClsPatient.PatientDAL().GetAllPAtients(); dataGridView1.Enabled = true; } catch (Exception) { MessageBox.Show("Patient Can't be deleted."); } txtDelete.Text = ""; }