private void btnDelete_Click(object sender, EventArgs e) { if (ValidateChildren(ValidationConstraints.Enabled)) { if (txtCategoryName.Text != "") { if (MessageBox.Show("Do you really want to delete the category?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { BOProduct BO = new BOProduct(); BusinessManager BM = new BusinessManager(); BO.CategoryName = txtCategoryName.Text.Trim(); int res = BM.BALDeleteCategory(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 category to delete", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); txtCategoryName.Focus(); } } }