コード例 #1
0
        private void QLSP_Load(object sender, EventArgs e)
        {
            txtmasp.Enabled = false;
            LoadDgvSanPham();
            groupBox1.Enabled = false;
            try
            {
                Sanpham_BUS x = new Sanpham_BUS();
                txtmasp.Text = x.XuLyMaSP();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

            cbtrangthai.SelectedIndex = 0;
            cbtgbh.SelectedIndex      = 0;

            DataTable dt         = new DataTable();
            DataTable listCombox = Sanpham_BUS.GetTableLSP();

            cbmaloai.DisplayMember = "TENLOAI";//Word là tên trường bạn muốn hiển thị trong combobox
            cbmaloai.ValueMember   = "MALOAI";
            cbmaloai.DataSource    = listCombox;

            DataTable dt2         = new DataTable();
            DataTable listCombox2 = Sanpham_BUS.GetNCC();

            cbmancc.DisplayMember = "TENNCC";//Word là tên trường bạn muốn hiển thị trong combobox
            cbmancc.ValueMember   = "MANCC";
            cbmancc.DataSource    = listCombox2;
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                Sanpham_BUS x = new Sanpham_BUS();
                txtmasp.Text = x.XuLyMaSP();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            txtdongia.Clear();
            txttensp.Clear();
            txtsoluong.Clear();

            groupBox1.Enabled  = true;
            btncapnhat.Enabled = false;
            btluu.Enabled      = true;
            btnxoa.Enabled     = false;
        }