private void AddRow() { LineForm editForm = new LineForm(diary); if (editForm.ShowDialog() == DialogResult.OK) { diary.DiaryLines.Add(editForm.alteredLine); } }
private void EditCurrentRow() { DataGridViewRow row = DiaryGV.CurrentRow; if (row.IsNewRow) { AddRow(); } else { DiaryLine line = (DiaryLine)row.DataBoundItem; LineForm editForm = new LineForm(diary, line); if (editForm.ShowDialog() == DialogResult.OK) { diary.DiaryLines.Remove(line); diary.DiaryLines.Add(editForm.alteredLine); } } ProvisionData(); }