private void EditButton_Click(object sender, EventArgs e) { if (StudentListView.SelectedIndices.Count == 0) { return; } Student s = stud[StudentListView.SelectedIndices[0]]; EdditForm editForm = new EdditForm(s); if (editForm.ShowDialog() == DialogResult.OK) { StudentListView.Invalidate(); } }
private void AddButton_Click(object sender, EventArgs e) { Student s = new Student(); EdditForm editForm = new EdditForm(s); if (editForm.ShowDialog() != DialogResult.OK) { return; } stud.Add(s); StudentListView.VirtualListSize = stud.Count; StudentListView.Invalidate(); }