Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 1st, 2004, 06:52 PM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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

 
Old August 2nd, 2004, 04:28 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

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.
 
Old August 2nd, 2004, 07:48 AM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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...

 
Old August 3rd, 2004, 01:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

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
 
Old August 4th, 2004, 07:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 996
Thanks: 2
Thanked 11 Times in 11 Posts
Send a message via Yahoo to melvik
Default

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

Always:),
Hovik Melkomian.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to delete file System.IO.Delete error maricar C# 13 March 14th, 2014 06:50 AM
isFileOpen Laxmikant_it ASP.NET 2.0 Professional 1 March 27th, 2008 07:36 AM
Java IO error bb1234_00 Java Basics 2 March 26th, 2007 07:25 AM
Had IO Exception with stylesheet file - Help! IronStar XSLT 0 March 14th, 2005 03:01 AM
System.IO.FileNotFoundException cuca_macaii2000 BOOK: ASP.NET Website Programming Problem-Design-Solution 1 February 5th, 2005 10:10 AM





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