private void buttonAdd_Click(object sender, EventArgs e) { using (var form = new SecurityAddForm()) { if (form.ShowDialog() == DialogResult.OK) { var grantee = new Grantee(form.UserEmailOrId.Contains('@') ? GranteeType.Email : GranteeType.User, form.UserEmailOrId); foreach (DataGridViewRow row in dataGridViewACL.Rows) { if (grantee.Equals(row.Cells[1].Value)) { row.Selected = true; return; } } accessControlList.AddGrant(grantee, Permission.Default); SetACL(accessControlList); dataGridViewACL.Rows[dataGridViewACL.RowCount - 1].Selected = true; OnACLChanged(); } } }