private void Load_Button_Click(object sender, EventArgs e) { Grocery_List_Menu.Visible = false; inNout = new FileStream("Grocery_List", FileMode.Open, FileAccess.Read); try { while (inNout.Position != inNout.Length) { Grocery_Memory gm = (Grocery_Memory)formatter.Deserialize(inNout); Grocery_List_Object gl = new Grocery_List_Object(); gl.Location = new Point(x_pos, y_pos); gl.Object_ID = gm.Object_ID; gl.Name = gm.Item_Name; gl.Price = gm.Price; gl.Item_Quant = gm.Item_Quantity; list_Memory.Add(gl); Controls.Add(gl); //Spot change y_pos = (y_pos + 22 + 177); grand_Total += gl.Price + (gl.Price * gl.Tax); Grand_Total_Price_Label.Text = $"{grand_Total:C}"; } inNout.Close(); } catch (SerializationException) { MessageBox.Show("There is no list to be loaded from"); } } //END SAVE LOAD
public Grocery_Memory(Grocery_List_Object save_list) { Item_Name = save_list.Name; Price = save_list.Price; Object_ID = save_list.Object_ID; Item_Quantity = save_list.Item_Quant; }
private void CreateItem(string id, int location_Y) { Grocery_List_Object gl = new Grocery_List_Object(); gl.Location = new Point(x_pos, location_Y); //gl.Name = id; gl.Price = price_box; gl.Name = name_box; Controls.Add(gl); y_pos = (y_pos + 22 + 177); }
private void CreateItem(string id, int location_Y) { Grocery_List_Object gl = new Grocery_List_Object(); gl.Location = new Point(x_pos, location_Y); gl.Object_ID = id; gl.Name = name_box; gl.Price = price_box; list_Memory.Add(gl); Controls.Add(gl); y_pos = (y_pos + 22 + 177); //Other stuff grand_Total += gl.Price + (gl.Price * gl.Tax); Grand_Total_Price_Label.Text = $"{grand_Total:C}"; } //END ADD