private void ModifyButton_Click(object sender, EventArgs e) { int index = dataGridView1.SelectedCells[0].RowIndex; var form = new AddForm { CoordinateCalculation = Motions[index] }; if (form.ShowDialog() == DialogResult.OK) { iMotionBindingSource.RemoveAt(index); iMotionBindingSource.Insert(index, form.CoordinateCalculation); } }