private void button_torol_Click(object sender, EventArgs e) { if (listBox1.SelectedItem == null) { MessageBox.Show("Kérem válaszon egy pékárut."); } else { Pekaru pekaru = (Pekaru)listBox1.SelectedItem; textBox1.Text = pekaru.Nev; textBox2.Text = Convert.ToString(pekaru.Ar); checkBox1.Checked = pekaru.Laktozmentes; listBox1.Items.RemoveAt(listBox1.SelectedIndex); } }
private void button3_Click(object sender, EventArgs e) { Pakseg pekseg = (Pakseg)listBox2.SelectedItem; Pekaru pekaru = (Pekaru)listBox1.SelectedItem; pekseg.Termekek.Add(pekaru); listBox3.Items.Add(pekaru); /*listBox4.Items.Add(listBox2.SelectedItem.ToString()); * label1.Text = textBox3.Text+"\nAlapitva:"+ido+""; * string[] ws = listBox1.SelectedItem.ToString().Split('('); * textBox1.Text = ws[0]; * string[] ws2 = ws[1].Split(':'); * string[] ws3 = ws2[1].Split('/'); * textBox2.Text = ws3[0]; * if (listBox1.SelectedItem != null && listBox2.SelectedItem != null) * { * listBox3.Items.Add(ws[0] + " (" + ws3[0]+"Ft/db)"); * } * else { * MessageBox.Show("Kérem jelöljön ki mind 2 listából! " ); * }*/ }