Locked files

  • Thread starter Thread starter Nikolay Petrov
  • Start date Start date
N

Nikolay Petrov

How to check if the file, that i need to write to is locked, and if so
wait some time then try again?
 
Try to open it in a try-catch-end try block & if you get a FileIOException
then its already open
 
Nikolay Petrov said:
How to check if the file, that i need to write to is locked, and if so
wait some time then try again?

Try to open the file with 'FileShare.None' and catch the exception which is
thrown when the file is already in use. You can use a timer control to
periodically check the file until it can be opened.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top