473,398 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to check if file is OPEN

Dear All,

Is there a function in dotnet VB, which returns if a file is open or used by
other process?

Thanks, Alex
Nov 29 '05 #1
4 1837
"Alex Simic" <in********@gmx.ch> wrote in message news:uv**************@TK2MSFTNGP09.phx.gbl...
Dear All,

Is there a function in dotnet VB, which returns if a file is open or used by
other process?


Open it with exclusive access and catch any exception. If an
exception occurs then it's obviously in use.
Nov 29 '05 #2
Alex,

Is there a function in dotnet VB, which returns if a file is open or used
by
other process?

No the only possibility for that is trying to read it inside a try and catch
block.

Not much however I hope it helps something,

Cor
Nov 29 '05 #3
This has been a problem with Visual Basic since version 2.0. You'd think
Microsoft would be wise enough to add a method to the file class to check if
a file is opened and if so, ever return the username or something like that.
--
Dennis in Houston
"Alex Simic" wrote:
Dear All,

Is there a function in dotnet VB, which returns if a file is open or used by
other process?

Thanks, Alex

Nov 30 '05 #4
dgk
On Tue, 29 Nov 2005 16:29:04 -0800, Dennis
<De****@discussions.microsoft.com> wrote:
This has been a problem with Visual Basic since version 2.0. You'd think
Microsoft would be wise enough to add a method to the file class to check if
a file is opened and if so, ever return the username or something like that.


Sounds like a good idea but perhaps try to open it for write access?
Shouldn't it fail if it's open by another process? Not the most
efficient way perhaps but it should work. Of course it won't tell you
what process has it open.
Nov 30 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Dino | last post by:
dear all, i've created an application for a customer where the customer can upload ..csv-files into a specified ftp-directory. on the server, a php-script, triggered by a cronjob, reads all the...
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
19
by: wetherbean | last post by:
Hi group..I am writing a playlist management protocol where I have a file that holds all the playlists and a file that holds all the songs....before a playlist is created I need to check to see if...
6
by: Dino Buljubasic | last post by:
My application creates some temporary files that are deleted when my application terminates. However, if a temp file is open, it will not be deleted and application will crash. How can I...
9
by: Dino Buljubasic | last post by:
If I want to delete a file I can call File.Delete(filePath) but what happens if I am trying to delete the file that is open??? In java you would do someting like int status =...
4
by: jes | last post by:
hi, i have an open & delete btn. onclick of open as visio drawing opens in visio & onclick of delete the drawing gets deleted from the filesystem. The problem is i am unable to perform these...
5
by: cmay | last post by:
The only examples I have seen on how to check if a file is locked is to try to open it a catch an exception. MS has stated that you should never use error trapping in this manner. Is there no...
6
by: Ros | last post by:
There are 10 files in the folder. I wish to process all the files one by one. But if the files are open or some processing is going on them then I do not want to disturb that process. In that case...
4
by: giftson.john | last post by:
Hi, I am creating an application which migrates all documents from one repository to another repository. Before migration i have to verify all the documents are unique. No duplicates has to be...
2
by: Kimmo Laine | last post by:
Hi! Is there a way to check if file is already open/used by another process? I know that i can do something like this to check it try { StreamWriter sw = new StreamWriter(filename);...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.