private void editButton_Click(object sender, EventArgs e) { if (personsListView.SelectedIndices.Count == 0) { return; } Person p = pers[personsListView.SelectedIndices[0]]; EditPersonForm editForm = new EditPersonForm(p); if (editForm.ShowDialog() == DialogResult.OK) { personsListView.Invalidate(); } }
private void addButton_Click(object sender, EventArgs e) { Person p = new Person(); EditPersonForm editForm = new EditPersonForm(p); if (editForm.ShowDialog() != DialogResult.OK) { return; } pers.Add(p); personsListView.VirtualListSize = pers.Count; personsListView.Invalidate(); }