Is there a way to see if a file is in use?

  • Thread starter Thread starter Anthony Ho
  • Start date Start date
A

Anthony Ho

Hi,

I use the following:
FileOpen(taskmgrfile, "C:\trend.csv", OpenMode.Random, OpenAccess.Read,
OpenShare.LockRead)
to open a file, but it returns err.number 75 "The process cannot access the
file "C:\trend.csv" because it is being used by another process."

Is there a way to check if the file is in use before I try to open it?

thanks in advance!
 
Well, you could write your own IsOpen method for the File class, but it
would probably determine if the file is already open by doing the same
thing, ie, try doing a FileOpen in a Try/Catch and catch the already
open exception.
 
is there a more positive way?
What the heck does that mean?

Are there self-esteem issues with try/catch?

Bob Lehmann
 
Of course there is Bob!!!!!!!!!!

Didn't you know that constantly trying and failing is one of the main causes
of low self-esteem?
 
Back
Top