private void button2_Click(object sender, EventArgs e) { if (peopleListView.SelectedIndices.Count == 0) { return; } Person p = people[peopleListView.SelectedIndices[0]]; EditPersonForm editForm = new EditPersonForm(p); if (editForm.ShowDialog() == DialogResult.OK) { peopleListView.Invalidate(); } }
private void button1_Click(object sender, EventArgs e) { Person p = new Person(); var editForm = new EditPersonForm(p); if (editForm.ShowDialog() != DialogResult.OK) { return; } people.Add(p); peopleListView.VirtualListSize = people.Count; peopleListView.Invalidate(); }