Results 1 to 4 of 4

Thread: Access to path is denied

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2009
    Posts
    203

    Access to path is denied

    Hey; i'm trying to copy a file from one folder to an other using this code :
    Code:
            Dim strSrcPath As String = TrleLiteBox.Text
            Dim strDestPath As String = CopyTobox.Text
            Dim strFileName As String = "EDGEPTR.PCX"
    
    
            If Not System.IO.File.Exists(strDestPath & strFileName) Then
                System.IO.File.Copy(strSrcPath & strFileName, strDestPath & strFileName)
            End If
    But when I run the tool I get an error telling me the access to the path is denied.

    I'm running Windows 7.
    How can I grant it access?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Access to path is denied

    What exactly is the path that you're trying to access?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2009
    Posts
    203

    Re: Access to path is denied

    I want to copy from

    C:\Program Files\Core Design\TRLE\

    to

    C:\Program Files\PlayTRLE\

  4. #4
    Frenzied Member MaximilianMayrhofer's Avatar
    Join Date
    Aug 2007
    Location
    IM IN YR LOOP
    Posts
    2,001

    Re: Access to path is denied

    By default on Vista you need administrator permission to write to the Program Files directory. You'll have to run your program as administrator in order for it to work.

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