User.IsInRole Method (BuiltInRole)
Determines whether the current user belongs to the specified role.
Assembly: Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)
The My.User.IsInRole method allows your code to determine if the current user is a member of the specified role.
The overload of the My.User.IsInRole method that takes a string provides easy access to the IsInRole method of the current principal.
The overload of the My.User.IsInRole method that takes a BuiltInRole enumeration behaves differently, depending on the current principal. If it is a Windows user principal (WindowsPrincipal), this function converts role to the equivalent WindowsBuiltInRole enumeration and returns the result of calling IsInRole. If the current principal is any other principal, this function passes the name of the enumeration value in role to the principal's IsInRole method.
The exact behavior of the My.User object depends on the type of the application and on the operating system on which the application runs. For more information, see the User class overview.
Availability by Project Type
Windows Control Library
Web Control Library
Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.