private void btnAddLogin_Click(object sender, EventArgs e) { frmAddEditLogin f = new frmAddEditLogin(); f.public_userID = _userID; f.public_isNew = true; if (f.ShowDialog() == DialogResult.OK) { LoadLogins(); } }
//When we double click on a cell, we open the "Edit" functionality of the AddEditLogin private void dgvUserAccounts_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { //Get the selected row int selectedrowindex = dgvUserAccounts.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = dgvUserAccounts.Rows[selectedrowindex]; frmAddEditLogin f = new frmAddEditLogin(); f.public_userID = _userID; f.public_isNew = false; f.public_AccountID = Convert.ToInt32(selectedRow.Cells["AccountID"].Value.ToString()); //If we get an "OK" on the edit, refresh the data if (f.ShowDialog() == DialogResult.OK) { LoadLogins(); } }