// public List<BuyBk> blist; public Form_dispPk() { InitializeComponent(); CenterToParent(); List <BuyBk> list = BuyBkServices.GetAllBuyBk(); dataGridView1.DataSource = list; // blist = list; float sun = 0f; float disp = 0f; float user = 0f; for (int i = 0; i < list.Count; i++) { sun += float.Parse(list[i].Buyprice); if (list[i].BuyFrom == "system") { disp += float.Parse(list[i].Buyprice); } else { user += float.Parse(list[i].Buyprice); } } this.lab_dis.Text = disp.ToString("0.00"); this.lab_sun.Text = sun.ToString("0.00"); this.lab_user.Text = user.ToString("0.00"); }
public Form_dispbk() { InitializeComponent(); this.dataGridView1.DataSource = BuyBkServices.GetAllBuyBk(); CenterToParent(); }