C
Chad Dore'
I have a program that takes a single text file, reads thru it, finds a break
point based on information in the file and then outputs a single file, then
continues the process.
The end result is many smaller files from one large file.
I'm using the StreamReader and StreamWriter classes from System.IO to
accomplish this.
On my main form I have some text boxes that allow me to enter a date and the
code uses it to determine which original file to process into smaller ones.
I click a command button and the process starts.
Since my smaller files are all output to the same folder, I delete the files
from the previous run prior to starting a new one.
The problem I'm getting is that I can't seem to get all the files deleted
without catching an exception on a few of them which states that the file is
in use by another process. I can't seem to determine why it thinks these
files are in use. I'm calling .close() on the reader and writer and also
setting them both to =Nothing
The only way I can get it to run correctly is to completely close the
application then re-open it. I'm assuming there's some sort reference to
these files that's only being cleared when the application closes. How can
I call these clearing methods from within the application?
Thanks for any responses. If more information is needed or I need to post
some code let me know.
point based on information in the file and then outputs a single file, then
continues the process.
The end result is many smaller files from one large file.
I'm using the StreamReader and StreamWriter classes from System.IO to
accomplish this.
On my main form I have some text boxes that allow me to enter a date and the
code uses it to determine which original file to process into smaller ones.
I click a command button and the process starts.
Since my smaller files are all output to the same folder, I delete the files
from the previous run prior to starting a new one.
The problem I'm getting is that I can't seem to get all the files deleted
without catching an exception on a few of them which states that the file is
in use by another process. I can't seem to determine why it thinks these
files are in use. I'm calling .close() on the reader and writer and also
setting them both to =Nothing
The only way I can get it to run correctly is to completely close the
application then re-open it. I'm assuming there's some sort reference to
these files that's only being cleared when the application closes. How can
I call these clearing methods from within the application?
Thanks for any responses. If more information is needed or I need to post
some code let me know.