04-20-2011, 12:12 PM
(This post was last modified: 04-20-2011, 12:18 PM by Resistance.)
Hello there. Today I shall be teaching you how to verify if your application had been ran as an administrator with administrator privileges all in a few easy lines of code.
So allow me to demonstrate:
Get Your Project Ready.
Then make a label named Status
Then have a button.
Double click the button and use this code:
Here is a little animation for you guys below to show some results:
Enjoy and don't forget to say thanks if this helps.
So allow me to demonstrate:
Get Your Project Ready.
Then make a label named Status
Then have a button.
Double click the button and use this code:
Code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then
Status.Text = "Yes, I am the big boss."
Else
Status.Text = "No, maybe next time."
End If
End Sub
End Class
Here is a little animation for you guys below to show some results:
Enjoy and don't forget to say thanks if this helps.