|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
File Accessthe following code
file.delete(filedetails) Dim FileStream As StreamWriter = New StreamWriter(filedetails) produces this error The process cannot access the file "D:\data.txt" because it is being used by another process. Single user XP sp2 pro environment. I have tried to sleep the process without success, any ideas would be appreciated. George,
> Which one creates the error, I assume the first, because I assume that it is > file.delete(filedetails) > Dim FileStream As StreamWriter = New StreamWriter(filedetails) > > still reading that one. (An often made mistake). I create it in that case forever it more like this. sr.close 'streamreader close file.move(filedetails, mytempfile) 'renaming and saving Dim FileStream As StreamWriter = New StreamWriter(filedetails) and when it is ready file.delete(mytempfile) I hope this helps, Cor Tried the example below, but still receive the same error message after the
"move" Show quoteHide quote "Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message news:%23aFScqaOFHA.2532@TK2MSFTNGP09.phx.gbl... > George, > >> >> file.delete(filedetails) >> Dim FileStream As StreamWriter = New StreamWriter(filedetails) >> >> > Which one creates the error, I assume the first, because I assume that it > is still reading that one. (An often made mistake). I create it in that > case forever it more like this. > > sr.close 'streamreader close > file.move(filedetails, mytempfile) 'renaming and saving > Dim FileStream As StreamWriter = New StreamWriter(filedetails) > and when it is ready > file.delete(mytempfile) > > I hope this helps, > > Cor > George,
On what line you get the error while debugging? This can be on every line you know. Cor
HLP: Retrieving ListView String Information
?syntax to recognize code in a 2nd file Scripting Runtime ARRAYLIST ADDING A CLASS Question on updating data Checking a string for valid date sockets O.T.:Shameless Plug to get Free Software(for me & for you too) How to provide hint on sub params? Transpose datagrid row to corresponding label text |
|||||||||||||||||||||||