What's Here?
- Members: 340,158
- Replies: 920,565
- Topics: 154,959
- Snippets: 4,855
- Tutorials: 1,257
- Total Online: 4,068
- Members: 125
- Guests: 3,943
|
|
Submitted By:
RodgerB
|
|
Rating:

|
| Views: 6,138 |
Language: VB.NET |
| Last Modified: December 23, 2007 |
Instructions:
1) Copy and paste the function into a class.
2) Read how to call the function. |
Snippet
''' <summary>
''' Check if the user belongs to the administrators group.
''' </summary>
''' <returns>True if the user belongs to the administrators group.</returns>
''' <remarks></remarks>
Public Function isAdministrator() As Boolean
' Check if the user is authenticated before continuing.
If My.User.IsAuthenticated Then
' If the user is in the administrators group.
If My.User.IsInRole("Administrators") Then
Return True
End If
End If
' Return false because the user isn't an administrator,
' or authenticated.
Return False
End Function
' Example Usage
MessageBox.Show(isAdministrator())
Copy & Paste
|
|
|
Be Social
Reference Sheets
Bye Bye Ads
Monthly Drawing
Top Contributors
Top 10 Kudos This Month
|