コード例 #1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            var          nv     = dgvNhanVien.CurrentRow.DataBoundItem as NhanVien;
            DialogResult result = MessageBox.Show("Bạn có chắc chắn xóa", "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (result == DialogResult.OK)
            {
                if (NhanVienBus.DeleteNhanVien(nv.MaNV))
                {
                    MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    data = NhanVienBus.GetListNhanVien();
                    dgvNhanVien.DataSource = data;
                }
                else
                {
                    MessageBox.Show("Xóa thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }