Help. Can't overwrite "File in use".

  • Thread starter Thread starter Mugsy_in_Houston
  • Start date Start date
M

Mugsy_in_Houston

Guest
I have a program that checks for a Whitelist on start and (should) allow you to update it.

In main Form_Load (this part works fine):


'in a separate module:
Public strOutput As StreamWriter
Public strInput As StreamReader
...

'In main Form_Load...
strInput = FileIO.FileSystem.OpenTextFileReader(strCfgPath & "Whitelist.ini")
intWL = -1 ' 0 is the header.
Do
intWL += 1
strWhitelist(intWL) = strInput.ReadLine ' Load array with WL entries.
Loop Until strWhitelist(intWL) = "*** EOF ***"
intWL -= 1 ' Total # of items in WL.




But later (only thing before this line is a Comment):

strOutput = FileIO.FileSystem.OpenTextFileWriter(strCfgPath & "Whitelist.ini", False) ' Don't Append. Overwrite.

...gives me a "file in use" error:

1616871.jpg

Must I close the file opened for input before I can replace it? And if so, how? There is no "FileIO.FileSystem.Close" function.

TIA.

Continue reading...
 
Back
Top