private void DataJobsEdit() { using DataJobForm form = new DataJobForm { DataJob = (DataJob)dataJobsGrid.SelectedRows[0].DataBoundItem }; var index = Properties.Settings.Default.DataJobs.IndexOf((DataJob)dataJobsGrid.SelectedRows[0].DataBoundItem); if (form.ShowDialog() == DialogResult.OK) { Properties.Settings.Default.DataJobs.RemoveAt(index); Properties.Settings.Default.DataJobs.Insert(index, form.DataJob); } dataJobsGrid.Rows[index].Selected = true; }