|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Is there a way to see if a file is in use?Hi,
I use the following: FileOpen(taskmgrfile, "C:\trend.csv", OpenMode.Random, OpenAccess.Read, OpenShare.LockRead) to open a file, but it returns err.number 75 "The process cannot access the file "C:\trend.csv" because it is being used by another process." Is there a way to check if the file is in use before I try to open it? thanks in advance! Why not put your FileOpen in a Try/Catch block and trap that particular
error? is there a more positive way?
<za***@construction-imaging.com> wrote in message Show quoteHide quote news:1145563225.438363.102600@v46g2000cwv.googlegroups.com... > Why not put your FileOpen in a Try/Catch block and trap that particular > error? > >is there a more positive way? <z***@construction-imaging.com> wrote in messagenews:1145563225.438363.102600@v46g2000cwv.googlegroups.com... -> Show quoted text ->- Hide quoted text - > Why not put your FileOpen in a Try/Catch block and trap that particular I also think that Try/catch is the way to doi..> error? see here ..maybe can helps you http://www.swapcode.com/domdoc/page/lscode003.html regards, Al Well, you could write your own IsOpen method for the File class, but it
would probably determine if the file is already open by doing the same thing, ie, try doing a FileOpen in a Try/Catch and catch the already open exception. >> is there a more positive way? What the heck does that mean?Are there self-esteem issues with try/catch? Bob Lehmann Show quoteHide quote "Anthony Ho" <wing***@addr.com> wrote in message news:OeR0BaLZGHA.1228@TK2MSFTNGP02.phx.gbl... > > is there a more positive way? > > <za***@construction-imaging.com> wrote in message > news:1145563225.438363.102600@v46g2000cwv.googlegroups.com... > > Why not put your FileOpen in a Try/Catch block and trap that particular > > error? > > > > Of course there is Bob!!!!!!!!!!
Didn't you know that constantly trying and failing is one of the main causes of low self-esteem? Show quoteHide quote "Bob Lehmann" <nospam@dontbotherme.zzz> wrote in message news:OYPdm0NZGHA.2136@TK2MSFTNGP05.phx.gbl... >>> is there a more positive way? > What the heck does that mean? > > Are there self-esteem issues with try/catch? > > Bob Lehmann > > "Anthony Ho" <wing***@addr.com> wrote in message > news:OeR0BaLZGHA.1228@TK2MSFTNGP02.phx.gbl... >> >> is there a more positive way? >> >> <za***@construction-imaging.com> wrote in message >> news:1145563225.438363.102600@v46g2000cwv.googlegroups.com... >> > Why not put your FileOpen in a Try/Catch block and trap that particular >> > error? >> > >> >> > >
Getting Exception on Command Line Args, but works within IDE debug
Multi-line comments Communication between forms Datagrid binding problem Mutable Types and Read-Only Fields Maximize form problem->bottom hidden by start bar VS2005 - Passing NumericUpDown into a class method? Editing Multiple DataGridViews security issues with an upgraded VB6 program DX9 SDK (Feb 2006) / .NET 2.0 |
|||||||||||||||||||||||