The simplest solution is NOT to delete the file, but simply create it. Sorry
if I wasn't clear on that point. It isn't necessary to delete it; creating
it will overwrite.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Poppy" <pa**********@NOSPAMthemedialounge.com> wrote in message
news:#N*************@TK2MSFTNGP11.phx.gbl...
If I can add lines to a textfile I dont know why I cant empty it.
I am already deleting it and recreating it bit I was wondering if there
was another solution.
"Kevin Spencer" <ke***@takempis.com> wrote in message
news:uq**************@TK2MSFTNGP10.phx.gbl... Just create an empty text file and overwrite the existing one.
--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"Poppy" <pa**********@NOSPAMthemedialounge.com> wrote in message
news:#1**************@TK2MSFTNGP09.phx.gbl... I use the following code to append a line of text to a text file :
Dim myFILENAME As String = Server.MapPath("/ABACUS/cvdocs/" &
fileName) Dim objStreamWriter As StreamWriter
objStreamWriter = File.AppendText(myFILENAME)
objStreamWriter.WriteLine(csvline)
objStreamWriter.Close()
The code works fine but I need to be a ble to delete the entire
contents of the file as well and I cant figure it out.
How can I open a text file and clean it out ?
Thanks in Advance