private void btnDelete_Click(object sender, EventArgs e) { if (ValidateChildren(ValidationConstraints.Enabled)) { if (txtCompanyName.Text != "") { if ((MessageBox.Show("Do you really want to delete this record?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)) { BOCompany BO = new BOCompany(); BusinessManager BM = new BusinessManager(); BO.CompanyName = txtCompanyName.Text.Trim(); int res = BM.BALDeleteCompany(BO); if (res > 0) { MessageBox.Show("Successfully deleted!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); New(); } else { MessageBox.Show("No record found", "Sorry", MessageBoxButtons.OK, MessageBoxIcon.Information); New(); } } } else { MessageBox.Show("Please enter a company to delete", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtCompanyName.Focus(); } } }