private void toolStripMenuItem18_Click(object sender, EventArgs e) { var editTool = dataGridViewMuseum.SelectedRows[0].DataBoundItem as Museum; AddMuseumForm admf = new AddMuseumForm(editTool); if (admf.ShowDialog() == DialogResult.OK) { museumBindingSource.ResetBindings(false); art.isChangeData = true; } }
private void button1_Click(object sender, EventArgs e) { if (adf.ShowDialog() == DialogResult.OK) { art.AddMuseum(adf.museum); museumBindingSource.ResetBindings(false); art.isChangeData = true; var lastIdx = dataGridViewMuseum.Rows.Count - 1; dataGridViewMuseum.Rows[lastIdx].Selected = true; dataGridViewMuseum.FirstDisplayedScrollingRowIndex = lastIdx; } }