Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 1st, 2004, 06:52 PM
Registered User
 
Join Date: Aug 2004
Location: Carrollton, GA, USA.
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

Reply With Quote
  #2 (permalink)  
Old August 2nd, 2004, 04:28 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
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.
Reply With Quote
  #3 (permalink)  
Old August 2nd, 2004, 07:48 AM
Registered User
 
Join Date: Aug 2004
Location: Carrollton, GA, USA.
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...

Reply With Quote
  #4 (permalink)  
Old August 3rd, 2004, 01:09 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
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
Reply With Quote
  #5 (permalink)  
Old August 4th, 2004, 07:35 AM
Friend of Wrox
Points: 3,558, Level: 25
Points: 3,558, Level: 25 Points: 3,558, Level: 25 Points: 3,558, Level: 25
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: California, USA
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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:51 PM.


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