コード例 #1
0
        private void load_MaLTK()
        {
            List <LoaiTietKiemDTO> listLTK = ltkBUS.selectListLTK();

            if (listLTK == null)
            {
                MessageBox.Show("Có lỗi khi lấy LoaiTietKiem từ DB");
                return;
            }
            // Load Loai tiet kiem
            cmbLoaiTietKiem.DataSource    = new BindingSource(listLTK, String.Empty);
            cmbLoaiTietKiem.DisplayMember = "StrMaLTK";
            cmbLoaiTietKiem.ValueMember   = "StrMaLTK";
            CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[cmbLoaiTietKiem.DataSource];

            myCurrencyManager.Refresh();
        }
コード例 #2
0
        private void loadLoaiTietKiemVao_Combobox()
        {
            List <LoaiTietKiemDTO> listLTK = ltkBUS.selectListLTK();

            if (listLTK == null)
            {
                MessageBox.Show("Có lỗi khi lấy LaoiTietKiem từ DB");
                return;
            }
            // Load Loai tiet kiem
            cmbMaLoaiTietKiem.DataSource    = new BindingSource(listLTK, String.Empty);
            cmbMaLoaiTietKiem.DisplayMember = "StrMaLTK";
            cmbMaLoaiTietKiem.ValueMember   = "StrMaLTK";
            CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[cmbMaLoaiTietKiem.DataSource];

            myCurrencyManager.Refresh();


            // Load Loai Ky Han
            cmbLoaiKyHan.DataSource    = new BindingSource(listLTK, String.Empty);
            cmbLoaiKyHan.DisplayMember = "IKyhan";
            cmbLoaiKyHan.ValueMember   = "IKyHan";
            myCurrencyManager          = (CurrencyManager)this.BindingContext[cmbMaLoaiTietKiem.DataSource];
            myCurrencyManager.Refresh();

            cmbLoaiKyHan_QD3.DataSource    = new BindingSource(listLTK, String.Empty);
            cmbLoaiKyHan_QD3.DisplayMember = "IKyhan";
            cmbLoaiKyHan_QD3.ValueMember   = "StrMaLTK";
            myCurrencyManager = (CurrencyManager)this.BindingContext[cmbLoaiKyHan_QD3.DataSource];
            myCurrencyManager.Refresh();



            // Load Ten Loai Tiet Kiem
            cmbTenLoaiTietKiem.DataSource    = new BindingSource(listLTK, String.Empty);
            cmbTenLoaiTietKiem.DisplayMember = "StrTenLTK";
            cmbTenLoaiTietKiem.ValueMember   = "StrTenLTK";
            myCurrencyManager = (CurrencyManager)this.BindingContext[cmbMaLoaiTietKiem.DataSource];


            if (cmbMaLoaiTietKiem.Items.Count > 0)
            {
                cmbMaLoaiTietKiem.SelectedIndex = 0;
            }
        }