コード例 #1
0
ファイル: MainForm.cs プロジェクト: muradxan/FSDE_2912_az
 private void editButton_Click(object sender, EventArgs e)
 {
     if (peopleListBox.SelectedItem is Person person)
     {
         var editForm = new AddForm(person);
         var result   = editForm.ShowDialog();
         if (result == DialogResult.OK)
         {
             var index = peopleListBox.SelectedIndex;
             people.RemoveAt(index);
             people.Insert(index, editForm.Person);
             peopleListBox.Items.RemoveAt(index);
             peopleListBox.Items.Insert(index, editForm.Person);
         }
     }
 }