Checking Resource Status of a File

  • Thread starter Thread starter Jason E. Trout
  • Start date Start date
J

Jason E. Trout

Is there anyway in VB.NET to test a file to see if another resource is
currently using it? Basically, through an automated process, a file is
opened (and then closed with user intervention); however, I need to be
able to carry on a process after that fact, so I'd like to poll the
file until the resource has been given up. Any advice would be greatly
appreciated.


Thank You,
Jason E. Trout
(e-mail address removed)
 
* (e-mail address removed) (Jason E. Trout) scripsit:
Is there anyway in VB.NET to test a file to see if another resource is
currently using it? Basically, through an automated process, a file is
opened (and then closed with user intervention); however, I need to be
able to carry on a process after that fact, so I'd like to poll the
file until the resource has been given up.

The only way to do that I am aware of is to try to open the file for
shared reading and catch an exception if the file cannot be opened in
this mode.
 
Hi Jason,

In addition to Herfried,

When it is an Access file than do not what is everywhere told (as well by
me) for a database and to close it every time after you did a dataadapter
fill or dataadapter update. Keep it open all the time, the same you should
do in situations for other files in my opinion which are not freeed to use
by other users.

I hope this helps?

Cor
 
Back
Top