Results 1 to 8 of 8

Thread: The Process Cannot Access the File Because It Is Being Used By Another Process

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2012
    Posts
    106

    The Process Cannot Access the File Because It Is Being Used By Another Process

    I am getting this error at this line:

    My.Computer.FileSystem.RenameFile(objListViewItem.Text, InputBox("Please enter the new name of the file."))

    Sometimes I get the error, sometimes it works. No open windows do seem to be using this file I'm using. Thanks in advance.

  2. #2
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    Re: The Process Cannot Access the File Because It Is Being Used By Another Process

    More the likely the file is open, even though you dont see it in a window. I thiunk if you go to task manager you might see a process with the file in question

    I had an old xp computer that would never seem to shut down word correctly, the program wasnt open when i looked for oepn windows but sure enough in taks manager you could see it still running.

    The fact that you "sometimes get the error would lead me to think that is what is happening. Is this a file that you open somewhere else in your program? have a look in your task manager

    if so try to explicitly close it

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2012
    Posts
    106

    Re: The Process Cannot Access the File Because It Is Being Used By Another Process

    I do not use this file in any other place in my program. After I restarted my computer, everything seemed to be fine. Like you said, I suspect it to be a process, not an open window. However, I don't know any way of checking if a file is in use, and if so, in what process. If you know any way to find if/what process is using a file, please tell me. Thank you so much!

  4. #4
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    Re: The Process Cannot Access the File Because It Is Being Used By Another Process

    Well what file is it? it must some how being used?

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Apr 2012
    Posts
    106

    Re: The Process Cannot Access the File Because It Is Being Used By Another Process

    The file name was not a constant, so I don't really remember which file it was. However, the problem seems to be fixed. Again, if someone has a way to find out what process is using what files, I'd gladly appreciate.

    Just found a solution, works great: http://windowsxp.mvps.org/processlock.htm

  6. #6
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    Re: The Process Cannot Access the File Because It Is Being Used By Another Process

    So what was going on?

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Apr 2012
    Posts
    106

    Re: The Process Cannot Access the File Because It Is Being Used By Another Process

    Appearantly, it was some process, because after I restarted my computer, it was gone. But thanks for everyone's help.

  8. #8
    Frenzied Member
    Join Date
    Aug 2009
    Location
    Los Angeles
    Posts
    1,335

    Re: The Process Cannot Access the File Because It Is Being Used By Another Process

    Quote Originally Posted by TheBilly102030 View Post
    Appearantly, it was some process, because after I restarted my computer, it was gone. But thanks for everyone's help.
    please mark resolved

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