Results 1 to 5 of 5

Thread: What am I doing wrong???

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    158

    Question What am I doing wrong???

    I wrote a simple VB.NET application. When the program, which writes a super-short text file to the desktop, is run from within Visual Studio, it runs just fine. However, when it is run by double-clicking the .exe file, this error appears: Unhanded exception has occurred... Access to the path "desktop" is denied.

    I checked explorer and the security in the desktop folder appears to be set correctly. What on earth is wrong?

  2. #2
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,630

    Re: What am I doing wrong???

    Does it work if you right-click the .exe file and choose "Run As Administrator"?

  3. #3
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,958

    Re: What am I doing wrong???

    Quote Originally Posted by groston View Post
    I wrote a simple VB.NET application. When the program, which writes a super-short text file to the desktop, is run from within Visual Studio, it runs just fine. However, when it is run by double-clicking the .exe file, this error appears: Unhanded exception has occurred... Access to the path "desktop" is denied.

    I checked explorer and the security in the desktop folder appears to be set correctly. What on earth is wrong?
    How are you getting the path to the desktop?

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    May 2002
    Posts
    158

    Re: What am I doing wrong???

    Thanks for the replies.

    OptionBase1: Same error

    PausiblyDamp: Dim dirPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)

  5. #5
    Frenzied Member
    Join Date
    Apr 2016
    Posts
    1,415

    Re: What am I doing wrong???

    Hi can you try:

    Code:
    .DesktopDirectory
    Also, it is very hard to figure out your problem with only one line of code you provided. I would suggest you post the whole block...

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width