コード例 #1
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            btnTao.Enabled = true;
            try
            {
                DialogResult r = MessageBox.Show("Muốn lưu tất cả?", "Không thể sửa xóa nữa", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (r == DialogResult.Yes)
                {
                    gvNCC.Enabled = true;

                    bool kq = ncc.them(lstNCC);
                    if (kq == true)
                    {
                        btnTao.Enabled = true;
                        btnLuu.Enabled = false;
                        load_CboMa();
                        load_gvNcc();
                        pTemp = null;
                        lstNCC.Clear();
                        MessageBox.Show("Thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Lưu thất bại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }