Can I access a file used by another process?
Can I access a file used by another process?
Can I access a file used by another process?
Can I access a file used by another process?
Can I access a file used by another process?
Can I access a file used by another process? Can I access a file used by another process? Can I access a file used by another process? Can I access a file used by another process? Can I access a file used by another process? Can I access a file used by another process? Can I access a file used by another process? Can I access a file used by another process?
Can I access a file used by another process? Can I access a file used by another process?
Can I access a file used by another process?
Go Back  Xtreme Visual Basic Talk > > > Can I access a file used by another process?


Reply
 
Thread Tools Display Modes
  #1  
Old 02-08-2005, 03:24 PM
esmithz esmithz is offline
Centurion
 
Join Date: Dec 2001
Location: Washington D.C.
Posts: 142
Default Getting error when trying to read a file via system.io.filestream.


Hello.
I have this vb.net app where I'm using a system.io.filestream object to access a file.

fso = New System.IO.FileStream(m_NativeFile, IO.FileMode.Open, IO.FileAccess.Read)

I'm getting the following error.

"The process cannot access the file "f:\....." because it is being used by another process."

The file I'm trying to access is located on a server as part of a local network. Other clients on the network are using this file. 99% of the time use is restricted to read only.

How can I read this file without getting this error. I was able to do this in VB6. I've searched the internet for days now but no clue. Many others get the same problem.

Any help would be greatly appreciated.

Last edited by esmithz; 02-09-2005 at 10:46 AM. Reason: Original Description was not clear
Reply With Quote
  #2  
Old 02-12-2005, 02:12 PM
MKoslof's Avatar
MKoslofCan I access a file used by another process? MKoslof is offline
Cum Grano Salis

Retired Moderator
* Guru *
 
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
Default

Try something like this:

Code:
Dim str As Stream = File.Open(FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite) Dim sr As StreamReader sr = New StreamReader(str)
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Can I access a file used by another process?
Can I access a file used by another process?
Can I access a file used by another process? Can I access a file used by another process?
Can I access a file used by another process?
Can I access a file used by another process?
Can I access a file used by another process? Can I access a file used by another process? Can I access a file used by another process? Can I access a file used by another process? Can I access a file used by another process? Can I access a file used by another process? Can I access a file used by another process?
Can I access a file used by another process?
Can I access a file used by another process?
 
Can I access a file used by another process?
Can I access a file used by another process?
 
-->