473,385 Members | 1,796 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,385 software developers and data experts.

StreamReader error.

Hello.

I am trying to open a filestream using the following code:

Dim myStreamReader As StreamReader = New StreamReader( _

New FileStream("H:\files\file.txt", FileMode.Open), _

System.Text.Encoding.Unicode)
I receive the following error:

"An unhandled exception of type 'System.UnauthorizedAccessException'
occurred in mscorlib.dll

Additional information: Access to the path "H:\files\file.txt" is denied."

Any suggestions? The code is in a VB class that I'm calling from a
different project.

Thanks.

Nov 20 '05 #1
1 896
Hi,

I had no trouble with your code. Do you have access to that drive as the
user you are currently logged in as?

Bernie Yaeger

"ext237" <ex****@houston.rr.com> wrote in message
news:3f***********************@newscene.com...
Hello.

I am trying to open a filestream using the following code:

Dim myStreamReader As StreamReader = New StreamReader( _

New FileStream("H:\files\file.txt", FileMode.Open), _

System.Text.Encoding.Unicode)
I receive the following error:

"An unhandled exception of type 'System.UnauthorizedAccessException'
occurred in mscorlib.dll

Additional information: Access to the path "H:\files\file.txt" is denied."

Any suggestions? The code is in a VB class that I'm calling from a
different project.

Thanks.


Nov 20 '05 #2

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

Similar topics

4
by: Mike | last post by:
I created a StreamReader object from a local file on my c:\ drive StreamReader srTemp = new StreamReader("C:\\myFile.txt") I then used a RegEx to strip out all the html and save what's left to...
9
by: oafyuf | last post by:
Hi, I'm having performanbce issues with StreamReader and was wondering what I could do to improve it... The following takes around 3 seconds to process! The content of the response is: ...
9
by: ShadowOfTheBeast | last post by:
Hi, I have got a major headache understanding streamReader and streamWriter relationship. I know how to use the streamreader and streamwriter independently. but how do you write out using the...
21
by: JoKur | last post by:
Hello, First let me tell you that I'm very new to C# and learning as I go. I'm trying to write a client application to communicate with a server (that I didn't write). Each message from the...
8
by: WordVBAProgrammer | last post by:
I've been struggling with this for a few days now. It worked originally as plain VB-type strings, but for some reason ceased creating the FileNm. I changed the code to use StringBuilder, but...
6
by: TechieMom | last post by:
I have the following code: Dim oFile As Stream Dim oReader As StreamReader Dim strCarName oFile = .GetExecutingAssembly.GetManifestResourceStream("Assignment3.Vehicles.txt")
0
by: Al Wilkerson | last post by:
Hey, Has anyone ever got a "Unable to read data from transport connected" message after reading data from a streamreader composed of a networkstream. For example: Server TcpListener...
9
by: Matt Bailey | last post by:
I am writing an ASP page with a C# backend. This page uses a StreamReader to input a file and pull out a specific section of the text based on markers inside. While the code I have works, I get a...
1
by: Arpan | last post by:
The contents of a text file are as follows: The Quick Brown Fox Jumped Over The Lazy Dog. Note that there isn't any space at the end of each of the 3 lines. Now when I do this:
5
by: =?Utf-8?B?V2lsbGlhbSBGb3N0ZXI=?= | last post by:
Good evening all, I am trying to write a process that uses a while loop to cycle multiple files from an array throught the StreamReader Process. The whole thing works using: Dim...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.