コード例 #1
0
ファイル: frmBCTon.cs プロジェクト: nguyenphuong152/QLOTO
        private void loadVTPT_Het_Vao_GridView()
        {
            List <VatTuPhuTungDTO> listVatTuPhuTung = vtptBus.select_het();

            if (listVatTuPhuTung == null)
            {
                MessageBox.Show("Có lỗi khi lấy DB");
                return;
            }

            data_het.Columns.Clear();
            data_het.DataSource = null;

            data_het.AutoGenerateColumns = false;
            data_het.AllowUserToAddRows  = false;
            data_het.DataSource          = listVatTuPhuTung;

            DataGridViewTextBoxColumn clMa = new DataGridViewTextBoxColumn();

            clMa.Name             = "Mavtpt";
            clMa.HeaderText       = "Mã VTPT";
            clMa.DataPropertyName = "Maloaivattu";
            data_het.Columns.Add(clMa);

            DataGridViewTextBoxColumn clTen = new DataGridViewTextBoxColumn();

            clTen.Name             = "Tenvtpt";
            clTen.HeaderText       = "Tên VTPT";
            clTen.DataPropertyName = "Tenloaivattu";
            data_het.Columns.Add(clTen);

            DataGridViewTextBoxColumn clTon = new DataGridViewTextBoxColumn();

            clTon.Name             = "Soluongton";
            clTon.HeaderText       = "Số lượng tồn";
            clTon.DataPropertyName = "Soluongton";
            data_het.Columns.Add(clTon);

            CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[data_het.DataSource];

            myCurrencyManager.Refresh();
        }