private void HandleDataGridDoubleClick() { int rowIndex = addressDataGridView.CurrentRow.Index; if (rowIndex >= 0) { string addressID = addressDataGridView[0, rowIndex].Value.ToString(); int bindingSourceId = addressesBindingSource.Find("AddressID", addressID); if (bindingSourceId >= 0) { AddEdit addEdit = new AddEdit(); addEdit.Position = bindingSourceId; if (addEdit.ShowDialog() == DialogResult.OK) { this.addressesTableAdapter.Fill(this.addresses._Addresses); addressDataGridView.ClearSelection(); addressDataGridView.Rows[rowIndex].Selected = true; } } } }
private void addToolStripMenuItem_Click(object sender, EventArgs e) { AddEdit addEdit = new AddEdit(); if (addEdit.ShowDialog() == DialogResult.OK) this.addressesTableAdapter.Fill(this.addresses._Addresses); }