The process cannot access the file

G

Guest

I use the following code to create a new FileStream

Dim fs As New FileStream(txtSourceFile.Text, FileMode.Open, FileAccess.Read, FileShare.None

where txtSourceFile is a text box which contains the path to the specified file

The problem is that whenever I try to open a file with the extension ".doc"
I get the following exception thrown at my face

An unhandled exception of type 'System.IO.IOException' occurred in mscorlib.dl
Additional information: The process cannot access the file "C:\Documents and Settings\My Documents\myFile.doc" because it is being used by another process

with other file formats (gif,jpg,pdf,etc.) the program works fine

How can I solve the problem

Thanks in advance
ALO
 
G

Guest

Three more important clarifications
1. This is a window application (not web
2. I am using VS.NET 200
3. I am using Windows XP pr
 
W

Willy Denoyette [MVP]

Someone else (or your own program) has opened the file already.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top