Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Unable to delete file through vb. Net

  1. Feb 20, 2012 #1
    Even if I use correct method or code for deleting files and folders, when debugging I get error saying that it cannot access file and hence cannot delete it. What setting of computer I should inprove to enable the delete feature through visual basic 2008
  2. jcsd
  3. Feb 20, 2012 #2
    I mean the code as. System.IO.file.delete(path of file) doesn't work nor kill(path of the file) works. I think my pc setting is weird. Someone tell me how to correct it.
  4. Feb 20, 2012 #3


    Staff: Mentor

    I'm going to guess that your VB program doesn't have the correct access rights to delete the file. What exception are you getting? The Delete method throws UnauthorizedAccessException if the caller doesn't have the required permission to delete the file.

    It also might be that the file you want to delete has its read-only attribute set.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook