private void butOK_Click(object sender, System.EventArgs e) { Userod selectedUser = (Userod)listUser.SelectedItem; if (selectedUser.Password != "") { if (!Userods.CheckPassword(textPassword.Text, selectedUser.Password)) { MsgBox.Show(this, "Incorrect password"); return; } //if (selectedUser.UserGroupNum == 1) this works to elevate privs to admin if (GroupPermissions.HasPermission(selectedUser.UserGroupNum, Permissions.AnesthesiaControlMeds)) { DialogResult = DialogResult.OK; Security.CurUser = (Userod)listUser.SelectedItem; return; } else { MessageBox.Show(this, "You must be an administrator to unlock this action"); } return; } }