private void button4_Click(object sender, EventArgs e) { ToyEditForm toyEdit = new ToyEditForm(allToys[listBox1.SelectedIndex]); toyEdit.ShowDialog(); RefreshData(); }
private void button1_Click(object sender, EventArgs e) { Toy toy = new Toy(); ToyEditForm toyEdit = new ToyEditForm(toy); toyEdit.ShowDialog(); if (toyEdit.DialogResult == DialogResult.OK) { allToys.Add(toy); listBox1.Items.Add(toy); } }