private void listBoxOrders_SelectedIndexChanged_1(object sender, EventArgs e) { if (orders.SelectedIndex > -1) { Sandwich s = sandwiches[orders.SelectedIndex]; nameBox.Text = s.Name; breadBox.Text = s.Bread; meatBox.Text = s.Meat; cheeseBox.Text = s.Cheese; checkBoxLuttuce.Checked = s.Condiments[0]; checkBoxSpinach.Checked = s.Condiments[1]; checkBoxTomato.Checked = s.Condiments[2]; checkBoxPickles.Checked = s.Condiments[3]; checkBoxPepper.Checked = s.Condiments[4]; } }
private void buttonOrder_Click(object sender, EventArgs e) { String name = nameBox.Text; String bread = breadBox.Text; String meat = meatBox.Text; String cheese = cheeseBox.Text; bool[] condiments = { lettuce.Checked, spinach.Checked, tomato.Checked, pickles.Checked, pepper.Checked }; Sandwich newSandwich = new Sandwich(name, bread, meat, cheese, condiments); Wiches.Add(newSandwich); ordersBox.Items.Add(newSandwich.Name); }