private void btnDelete_Click(object sender, EventArgs e) { lbl.Text = Header + ">>Deleting Card"; Community.DBLayer DBLayer = new Community.DBLayer(); bool DELETE = DBLayer.CHK_B4_DELETE(txtFCardNo.Text); if (DELETE) { MessageBox.Show("Cannot be Deleted! 'Already in use'", "Unable to Delete", MessageBoxButtons.OK); lbl.Text = Header; } else { DialogResult result = MessageBox.Show("Are You Sure You Want to Delete", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { try { string FCardNo = txtFCardNo.Text; usp_SEL_FAMILYTableAdapter.Delete1(FCardNo); usp_SEL_FAMILYTableAdapter.Fill(comDataSet.usp_SEL_FAMILY); MessageBox.Show("Deleted Succesfully!", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); lbl.Text = Header; } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { lbl.Text = Header; } } }