Geting XP - Vista with a program
well hi this is my second thread the first one still unsolved lets see about this one.
how can i do that when my program is open and its run in a Vista computer, it have to show a MsgBox and says Error please run as admin and when it is run as admin it wont appear ?
XP don't need to open as admin
P.S sorry for my English. and I'm sorry that i didn't explain good.(i think)
xfrolox
Junior Poster in Training
91 posts since Oct 2009
Reputation Points: 19
Solved Threads: 0
to require admin privileges add into your app.manifest this line
to check for privileges:
if not My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) then
msgbox "Sorry you have to be an administrator"
end if
i didn't put the line
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>
i just do this
Dim MymessageBox2
From load
If Not My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then
MymessageBox2 = MsgBox("Please Run as Administrator", MsgBoxStyle.Critical)
If MymessageBox2 = MsgBoxResult.Ok Then
Me.Close()
Thank you my problem is solve :)
xfrolox
Junior Poster in Training
91 posts since Oct 2009
Reputation Points: 19
Solved Threads: 0