Jump to content

Visual basic 2010 help


Node

Recommended Posts

 

Dim attribute As System.IO.FileAttributes = IO.FileAccess.ReadWriteSystem.IO.File.SetAttributes(safold.SelectedPath, attribute)System.IO.File.Copy(safold.SelectedPath, ListBox1.Items.Item(0), True)MsgBox("Files copied")

 

 

Okay, im trying to copy a file to a folder (safold.selectedpath) and i keep getting a "Access to path [safold's path] denied" as you can see im even editing the files attributes to read and write and i still get this error, the selected path isnt read only either, so whats causing this problem?

Link to comment
Share on other sites

Two possible causes I can think of. First, the path to copy the file to must contain the file name. It shouldn't be just a path to a folder to which you're copying. Second, if the file exists, File.Copy won't overwrite by default. To allow overwrite, you must call File.Copy(path_to, path_from, True).

Prior to filing a bug against any of my code, please consider this response to common concerns.

Link to comment
Share on other sites

If the files are in system folders such as "Program Files" or "Windows" you may need to run your program as administrator.

Link to comment
Share on other sites

Thanks for the reply dudes, given up on Visual basic as its a time waster icon13.gif

Started to learn c++ using "cprogramming.com"

 

Im currently using codeblocks as my debugger, cause vc++ is too complicated for me suicidal.gif

Link to comment
Share on other sites

VB is still a fast way to make Window based apps. smile.gif

And I think you meant to say Codeblocks as IDE ( Integrated Development Environment) ?

Link to comment
Share on other sites

nightwalker83
Thanks for the reply dudes, given up on Visual basic as its a time waster icon13.gif

Started to learn c++ using "cprogramming.com"

 

Im currently using codeblocks as my debugger, cause vc++ is too complicated for me suicidal.gif

How are you finding C++?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.