private void btnXoa_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (lsvPhieuNhap.SelectedItems.Count > 0) { dt = pn.Is_CTPN(txtMaPN.Text); DialogResult dr = MessageBox.Show("Bạn có chắc muốn xóa?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { if (dt.Rows.Count > 0) { pn.Xoa_CTPN(txtMaPN.Text); pn.XoaPN(txtMaPN.Text); lsvPhieuNhap.Items.RemoveAt(lsvPhieuNhap.SelectedIndices[0]); HienThiDSPN(); MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK); } else { pn.XoaPN(txtMaPN.Text); lsvPhieuNhap.Items.RemoveAt(lsvPhieuNhap.SelectedIndices[0]); HienThiDSPN(); MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK); } } } else { MessageBox.Show("Bạn cần chọn mẫu tin đễ xóa", "Thông báo", MessageBoxButtons.OK); } }