p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C# (http://p2p.wrox.com/forumdisplay.php?f=22)
-   -   C# File IO IsFileOpen (http://p2p.wrox.com/showthread.php?t=16265)

WGP3 August 1st, 2004 06:52 PM

C# File IO IsFileOpen
 
Hello all,
  I've looked through VS help and can't seem to find a clear way to see if a file is currently open by another user. I'd like to be able to check if a file is currently open by another user and if so display that file in a listview. Any code snips or help will be greatly appreciated...:D


mehdi62b August 2nd, 2004 04:28 AM

I don't know how you read your file where you use it even under which application you run your program....
in my opinion you can declare a static global variable when one of users works on file it has a value and when the user finishs working on file your global variable gets another value.through these two values you can determine the state of your file and manage access time of your file.
HTH.
wait for better opinions...

--------------------------------------------
Mehdi.

WGP3 August 2nd, 2004 07:48 AM

Mehdi,
   Thanks for the reply. What I'm trying to do is have a small winform that has a real time list of all files that are currently in use for an indicated directory. Setup: There is one server and two clients on the LAN and both clients have a drive mapped to the server the clients are running the winform and would like to see if the current files in a given directory are in use. Any other tips would be appreciated...


stu9820 August 3rd, 2004 01:09 PM

Try browsing through here: http://msluder.dk/Resources/cli/refd...ystemInfo.html


http://msluder.dk/Resources/cli/refd.../FileInfo.html

you could catch the exception and display a message after you check if the file.exists

melvik August 4th, 2004 07:35 AM

Yes try/catch is a best way to check it.

Always:),
Hovik Melkomian.


All times are GMT -4. The time now is 04:42 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.