Esempio n. 1
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            DialogResult traloi = MessageBox.Show("Bạn muốn xóa??", "Trả Lời", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (traloi == DialogResult.Yes)
            {
                try
                {
                    // lay dong hien hnah
                    int r = dgvNCC.CurrentCell.RowIndex;
                    // lay ma
                    string ma = dgvNCC.Rows[r].Cells[0].Value.ToString();
                    dbnhacungcap.delete(ma);
                    loadnhacungcap();
                    MessageBox.Show("Đã xóa xong rối!!!");
                }
                catch (Exception)
                {
                    MessageBox.Show("Không xóa được!!! Lỗi");
                }
            }
        }