On Jul 30, 12:59*pm, "tshad" <ts...@dslextreme.comwrote:
If I have the following:
* * * * * * fs = new FileStream(xmlFile, FileMode.Open,
System.IO.FileAccess.Read);
* * * * * * sr = new StreamReader(fs);
will sr.Close() also close the fs? *Or do I need to close both?
Thanks,
Tom
Hi,
Why not using a StreamReader from the start (if it's a Xml use
XmlReader instead)
if for some reason you still need to use your code do it like this:
using( FileStream fs = new FileStream(xmlFile, FileMode.Open,
System.IO.FileAccess.Read) ){
using( StreamReader sr = new StreamReader(fs) ){
}
}
It makes sure that the objects are disposed correctly
" Close - Closes the StreamReader object and the underlying stream, and
releases any system resources associated with the reader. (Overrides
TextReader.Close().) "
Andrew Faust
"tshad" <ts***@dslextreme.comwrote in message
news:#p**************@TK2MSFTNGP02.phx.gbl...
If I have the following:
fs = new FileStream(xmlFile, FileMode.Open,
System.IO.FileAccess.Read);
sr = new StreamReader(fs);
will sr.Close() also close the fs? Or do I need to close both?
I'm using StreamReader to read a text file and sometimes I get an error
saying that the file is opened by someone else.
I haven't found any info about how to set a flag to tell StreamReader to...
1. I have an .aspx file which parses an XML and XSL file out to
Response.Output.
2. However, after I run it once, the XML file is "locked" and I can't
open it until I end the ASP.NET process.
3....
In the following example, is it necessary to close the FileStream object as
well as the StreamWriter object?
FileStream fs = new FileStream(fileName,
FileMode.CreateNew, FileAccess.Write,...
I can successfully write the binary data to an image data type, and
successfully retrieve it, but when I attempt to play the file in media player
after retrieving it, I get the file type isn't...
The code I use is below. If I create a FileStream at Module level and then
call it from one of these callback routines, I get the "File is in use by
another process" exception. My workaround is...
Hi,
I am using VB.NET and trying to pull data from two different tables in
the database. I am using what I think is standard code. But the data
I am pulling is like the following:
Table1...
This will be my very first VB.Net application and it's pretty simple. But
I've got a snag in my syntax somewhere. Was hoping that someone could point
me in the right direction.
The history:
My...
i wrote some lines of code to parse xml file and tested it. It ran
correct independently but when i inserted that function in a
webservice and called it, it gave errors. The error at present is...
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...