private void deleteButton_Click(object sender, EventArgs e) { foreach (ListViewItem student in studentList.Items) { if (student.Selected) { studentList.Items.Remove(student); return; } } var addForm = new FormError("Ничего не выделено!"); addForm.ShowDialog(); }
private void editButton_Click(object sender, EventArgs e) { foreach (ListViewItem student in studentList.Items) { if (student.Selected) { var editForm = new FormEdit(student, this); editForm.ShowDialog(); return; } } var addForm = new FormError("Ничего не выделено!"); addForm.ShowDialog(); }
private void editButton_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(nameTextBox.Text) || string.IsNullOrEmpty(groupTextBox.Text)) { var addForm = new FormError("Не все поля заполнены!"); addForm.ShowDialog(); return; } else { var item = new ListViewItem(nameTextBox.Text); item.SubItems.Add(groupTextBox.Text); mainForm.studentList.Items[index] = item; this.Close(); } }