Link to home
Start Free TrialLog in
Avatar of Tom Sage
Tom SageFlag for United States of America

asked on

VB.NET - How to determine if a file is in use?

I can test if a file exists by using System.IO.File.Exists(filename), but how can I test for:

1) a file in use?

2) username using the file?

Thank you.
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

1. Try to open the file in Append mode.

Avatar of Tom Sage

ASKER

Would you give me a short example please?

Thanks
Eric,
Thanks for your response.  

I was wondering if .NET had the ability to report on a file in use and who is using it without having to create an exception to get the information.  If not, then we will get it from the exception.

Thank you
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Eric, thanks for your prompt response.  Too bad .NET doesnt supply this without having to create an exception.