private void btnXoa_Click(object sender, EventArgs e) { string idSach = txtIDSach.Text; string tenSach = txtTenSach.Text; if (idSach != "") { if (MessageBox.Show(this, $"Bạn có muốn xóa sách { tenSach } không ?", "Xác nhận", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes) { try { SachBUS.DelteSach(Int32.Parse(idSach)); MessageBox.Show(this, "Xóa sách thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadSach(); } catch { MessageBox.Show(this, $"Không thể xóa sách { tenSach }", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } return; } else { MessageBox.Show(this, "Bạn chưa chọn sách", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }