Overwrite a text file

fackrellb
08-27-2004, 11:46 AM
I’m using the following code to write a text file called notes.txt to a folder:
myStreamWriter = File.CreateText(formLibrary.componentPath & "\notes.txt")
In some cases the folder already contains a notes.txt file with write protection set. Is there a way that I can re-write this string so that, in every case, the existing notes.txt is overwritten with the new notes.txt?

Thanks
Brad

Iceplug
08-27-2004, 12:07 PM
Dim SW As StreamWriter = New StreamWriter(filename)
That overwrites filename if it already exists.
:)
Setting append to false will make sure that it overwrites, but I think it overwrites automatically.

fackrellb
08-27-2004, 12:41 PM
Works perfect...Thanks once again!

Brad

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum