private void lstIngrediënten_DoubleClick(object sender, EventArgs e) { AddIngrediënt editIngrediënt = new AddIngrediënt(ingrediënten[lstIngrediënten.SelectedIndex]); if (editIngrediënt.ShowDialog() == DialogResult.OK) { ingrediënten[lstIngrediënten.SelectedIndex] = editIngrediënt.Ingrediënt; } }
private void btnAddIngrediënt_Click(object sender, EventArgs e) { AddIngrediënt addIngrediënt = new AddIngrediënt(new IngrediëntEenheid()); if (addIngrediënt.ShowDialog() == DialogResult.OK) { if (ingrediënten.Contains(addIngrediënt.Ingrediënt)) { ingrediënten.Remove(addIngrediënt.Ingrediënt); } ingrediënten.Add(addIngrediënt.Ingrediënt); } }