Hi all,
I am using a streamreader to read txt files. This all works fine, but once it's done, I want to copy the text file to another location. In order to do this, I should close the streamreader, in order for the system to release the txt file right?
Well, this seems not to be working. I call streamreader.close.... but it doesn't release my txt file...
This is some of my code:
VB Code:
Select Case whatToDo Case "V" theFile.Delete() Case "B" sr.Close() IO.File.Move("C:\Netcash\DebitProcessor\2_Verification\" & theFile.Name, "C:\Netcash\DebitProcessor\3_MasterBatch\" & theFile.Name) Case "C" sr.Close() IO.File.Move("C:\Netcash\DebitProcessor\2_Verification\" & theFile.Name, "C:\Netcash\DebitProcessor\3_MasterBatch\" & theFile.Name) End Select
and this is my error:
An unhandled exception of type 'System.IO.IOException' occurred in mscorlib.dll
Additional information: The process cannot access the file "C:\3_MasterBatch\19642632673021796427000.txt" because it is being used by another process.
Thanks




Reply With Quote