P
poindexter frink
Fairly new to VB-style programming, so excuse me if I'm doing something
logical.
I'm working with CSV files, extracing certian columns, and ultimately
building a final CSV file.
I'm using the streamreader and streamwriter classes.
I'm having a runtime error that is inexplicable.
-- snip --
If Not infile Is Nothing Then
infile.Close()
End If
If IO.File.Exists(tempPath & "\old.csv") Then
IO.File.Delete(tempPath & "\old.csv")
End If
Rename(tempPath & "\new.csv", tempPath & "\old.csv")
-- snip --
What I'm doing here is testing to see if the infile (out.csv) is
initialized (if we're not in the first pass of the final CSV), and
closing it if it is. Then I'm deleting the old input file and replacing
it with the new input file.
The problem i'm having is that I get a runtime error at the
IO.File.Delete line, saying the "old.csv" is in use by another process.
I've put a breakpoint there, and infile is not initialized, so therefore
the file is not open by the streamreader class. Am I missing something
stupid like a flush? Or are my fundamentals off base.
-- dexter
logical.
I'm working with CSV files, extracing certian columns, and ultimately
building a final CSV file.
I'm using the streamreader and streamwriter classes.
I'm having a runtime error that is inexplicable.
-- snip --
If Not infile Is Nothing Then
infile.Close()
End If
If IO.File.Exists(tempPath & "\old.csv") Then
IO.File.Delete(tempPath & "\old.csv")
End If
Rename(tempPath & "\new.csv", tempPath & "\old.csv")
-- snip --
What I'm doing here is testing to see if the infile (out.csv) is
initialized (if we're not in the first pass of the final CSV), and
closing it if it is. Then I'm deleting the old input file and replacing
it with the new input file.
The problem i'm having is that I get a runtime error at the
IO.File.Delete line, saying the "old.csv" is in use by another process.
I've put a breakpoint there, and infile is not initialized, so therefore
the file is not open by the streamreader class. Am I missing something
stupid like a flush? Or are my fundamentals off base.
-- dexter