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)

to require admin privileges add into your app.manifest this line
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>

to check for privileges:

if not My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) then
msgbox "Sorry you have to be an administrator"
end if
Comments
Thank you for solving my problem.

to require admin privileges add into your app.manifest this line
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>

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 :)

This question has already been answered. Start a new discussion instead.