private void editUser() { int row = Convert.ToInt32(dataGridViewUserList.CurrentCell.RowIndex); if (row != null) { string accountID = dataGridViewUserList[0, row].Value.ToString(); string privelege = dataGridViewUserList[userPrivelegeCol, row].Value.ToString(); string name = dataGridViewUserList[userCol, row].Value.ToString(); EditUserAccount ep = new EditUserAccount(accountID, privelege, name); ep.ShowDialog(); } populateUserList(); try { dataGridViewUserList[1, row].Selected = true; } catch (Exception x) { } }