private void btnXoa_Click(object sender, EventArgs e) { try { //lấy hàng cần xóa int r = dgvLoaiThuoc.CurrentCell.RowIndex; //lấy mã khách hàng currentMVT = dgvLoaiThuoc.Rows[r].Cells[0].Value.ToString(); //hỏi xem có muốn xóa không DialogResult traloi; traloi = MessageBox.Show("Bạn có muốn xóa không?\nChú ý: Khi xóa loại thuốc thì tất cả các thông tin liên quan đến thuốc thuộc loại cũng bị xóa.\nHãy cân nhắc.", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (traloi == DialogResult.OK) { bool trangthai = dvtDAO.XoaDVT(currentMVT); if (trangthai) { MessageBox.Show("Xóa thành công!!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadData(); } else { MessageBox.Show("Không xóa được!!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { } } catch (Exception) { } }