//Редагування елементу у списку private void editFlatToolStripMenuItem_Click(object sender, EventArgs e) { var toEdit = flatGridView.SelectedRows[0].DataBoundItem as Flat; var pf = new NewFlat(toEdit); if (pf.ShowDialog() == DialogResult.OK) { flatBindingSource.ResetBindings(false); store.IsDirty = true; } }
// Додавання квартири у список private void AddNewFlatButton_Click_1(object sender, EventArgs e) { var pf = new NewFlat(); if (pf.ShowDialog() == DialogResult.OK) { store.AddFlat(pf.flat); flatBindingSource.ResetBindings(false); store.IsDirty = true; var lastIdx = flatGridView.Rows.Count - 1; flatGridView.Rows[lastIdx].Selected = true; flatGridView.FirstDisplayedScrollingRowIndex = lastIdx; } }