コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
 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();
     }
 }