예제 #1
0
        internal void BindProvider()
        {
            DrugShop.Entities.Provider provider = new DrugShop.Entities.Provider();
            IList <Provider>           PL       = provider.GetProviderList();

            this.cbxProvider.DataSource    = PL;
            this.cbxProvider.ValueMember   = "ID";
            this.cbxProvider.DisplayMember = "Name";
        }
예제 #2
0
        public static void BindFactoryCmbBox2(ComboBox comboBox)
        {
            DrugShop.Entities.Provider provider     = new DrugShop.Entities.Provider();
            IList <Provider>           providerList = provider.GetProviderList();

            DrugShop.Entities.Provider item = new DrugShop.Entities.Provider();
            item.ID   = 0;
            item.Name = "全部";

            providerList.Insert(0, item);

            comboBox.DataSource    = providerList;
            comboBox.ValueMember   = "ID";
            comboBox.DisplayMember = "Name";

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