//刷新 private void sx() { List <ProductType> list = ProductTypeBLL.selectall(); ProductType p = new ProductType(); p.id = 0; p.name = "全部"; list.Add(p); list.Reverse(); this.cbotype.DisplayMember = "name"; this.cbotype.ValueMember = "id"; this.cbotype.DataSource = list; // 显示白道一 foreach (var item in list) { if (item.id != 0) { ListViewItem lvi = new ListViewItem(item.id.ToString()); if (item.id != 0) { lvi.SubItems.Add(item.name); } this.lv.Items.Add(lvi); } } }
private void FrmProductsT_Load(object sender, EventArgs e) { List <ProductType> list = ProductTypeBLL.selectall(); this.cbotype.DisplayMember = "name"; this.cbotype.ValueMember = "id"; this.cbotype.DataSource = list; }
private void FrmProducts_Load(object sender, EventArgs e) { string id = Comm.ProductID; this.txtjp.Text = Comm.ProductJP; this.txtname.Text = Comm.ProductName; this.txtprice.Text = Comm.ProductPrice; List <ProductType> list = ProductTypeBLL.selectall(); this.cbotype.DisplayMember = "name"; this.cbotype.ValueMember = "id"; this.cbotype.DataSource = list; }