private void Add_New_Product_Load(object sender, EventArgs e) { comboBox1.DataSource = category.selectAll(); comboBox1.DisplayMember = "catName"; comboBox1.ValueMember = "catID"; comboBox2.DataSource = MWhareHouse.selectAll(); comboBox2.DisplayMember = "productName"; comboBox2.ValueMember = "id"; }
void fill() { BindingSource bindingSource1 = new BindingSource(); tot = 0; foreach (var i in MWhareHouse.selectAll()) { bindingSource1.Add(i); tot += Convert.ToDouble(i.totalPrice); } label7.Text = tot.ToString(); dataGridView1.DataSource = bindingSource1; }