944,044 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Marked Solved
  • Views: 780
  • VB.NET RSS
Oct 15th, 2009
-1

Geting XP - Vista with a program

Expand Post »
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)
Similar Threads
Reputation Points: 19
Solved Threads: 0
Junior Poster in Training
xfrolox is offline Offline
91 posts
since Oct 2009
Oct 16th, 2009
2
Re: Geting XP - Vista with a program
to require admin privileges add into your app.manifest this line
<requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>

to check for privileges:
vb Syntax (Toggle Plain Text)
  1. if not My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) then
  2. msgbox "Sorry you have to be an administrator"
  3. end if
Featured Poster
Reputation Points: 208
Solved Threads: 168
Practically a Master Poster
GeekByChoiCe is offline Offline
692 posts
since Jun 2009
Oct 16th, 2009
0

Thx

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

to check for privileges:
vb Syntax (Toggle Plain Text)
  1. if not My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) then
  2. msgbox "Sorry you have to be an administrator"
  3. end if
i didn't put the line
VB.NET Syntax (Toggle Plain Text)
  1. <requestedExecutionLevel level="requireAdministrator" uiAccess="false"/>

i just do this
VB.NET Syntax (Toggle Plain Text)
  1. Dim MymessageBox2
  2. From load
  3. If Not My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then
  4. MymessageBox2 = MsgBox("Please Run as Administrator", MsgBoxStyle.Critical)
  5. If MymessageBox2 = MsgBoxResult.Ok Then
  6. Me.Close()

Thank you my problem is solve
Reputation Points: 19
Solved Threads: 0
Junior Poster in Training
xfrolox is offline Offline
91 posts
since Oct 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: db4o,vb.net and my sql
Next Thread in VB.NET Forum Timeline: [URGENT]Convert String("2009") to Date(Year)





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC