private void changeToolStripMenuItem_Click(object sender, EventArgs e) { var toEdit = drugGridView.SelectedRows[0].DataBoundItem as Drug; if (toEdit != null) { var pf = new DrugForm(toEdit, directory); if (pf.ShowDialog() == DialogResult.OK) { } drugBindingSource.ResetBindings(false); directory.IsDirty = true; } }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { var pf = new DrugForm(directory); if (pf.ShowDialog() == DialogResult.OK) { } drugBindingSource.ResetBindings(false); directory.IsDirty = true; var lastIdx = drugGridView.Rows.Count - 1; drugGridView.Rows[lastIdx].Selected = true; drugGridView.FirstDisplayedScrollingRowIndex = lastIdx; }