public void Checkbox_click(object sender, EventArgs e) { price = 0; User_controll.Ing_box m = (User_controll.Ing_box)sender; price = Convert.ToInt16(m.label1.Text); main_price = Convert.ToInt32(this.food_price_lbl.Text.Remove(this.food_price_lbl.Text.Length - 1, 1)); // MessageBox.Show(); if (m.checkBox1.Checked != true) { m.checkBox1.Checked = true; ing_count++; main_price = main_price + price; this.food_price_lbl.Text = main_price.ToString() + "৳"; } else { m.checkBox1.Checked = false; ing_count--; main_price = main_price - price; this.food_price_lbl.Text = main_price.ToString() + "৳"; } }
public Menu_infocs(string food_name, string food_price, string food_des, List <Ing> ings, int food_id) { InitializeComponent(); fs = new Food_services(); quantity_lbl.Text = counter.ToString(); this.food_id = food_id; food_name_lbl.Text = food_name; food_price_lbl.Text = food_price; new_price = Convert.ToInt32(food_price.Remove(food_price.Length - 1, 1)); main_price = new_price; food_info_lbl.Text = food_des; for (int i = 0; i < ings.Count; i++) { box = new User_controll.Ing_box(); box.checkBox1.Text = ings[i].Ing_name; box.label1.Text = ings[i].ing_price.ToString(); exrta_in_panel.Controls.Add(box); box.Click += new EventHandler(this.Checkbox_click); } }
public void eventchange(object sender, EventArgs e, User_controll.Ing_box box) { }