private void btnDelete_Click(object sender, EventArgs e) { bool CHK2 = DBLayer.CHK_B4_DEL_Type1(txtName.Text); bool CHK = DBLayer.CHK_B4_DEL_Type(txtName.Text); if (CHK == true || CHK2 == true) { MessageBox.Show("Cannot Delete! Already in use", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { DialogResult result = MessageBox.Show("Are You Sure You Want to Delete", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { usp_SEL_tblWorkTypeTableAdapter.Delete1(Convert.ToInt32(txtID.Text)); usp_SEL_tblWorkTypeTableAdapter.Fill(comDataSet.usp_SEL_tblWorkType); MessageBox.Show("Deleted Succesfully!", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }