Clear File

PureSc0pe

Well-known member
Joined
Mar 17, 2004
Messages
161
Location
Arizona
I am trying to make it to where i can just click a button and a whole text file is erased. How would I go about doing this? Starting me with off with some coding would be great...Thanks..
 
Did you consider deleting the file and then recreating it? But if you still wanna do it like that here is how you can. Open the file using StreamWriter and specify the append argument as false which will clear the file.
Code:
 Dim wr As New IO.StreamWriter("file path", False)
 dont forget to close the stream
 wr.Close()
 
mutant said:
Did you consider deleting the file and then recreating it? But if you still wanna do it like that here is how you can. Open the file using StreamWriter and specify the append argument as false which will clear the file.
Code:
 Dim wr As New IO.StreamWriter("file path", False)
 dont forget to close the stream
 wr.Close()


Thanks, Im starting to figure this thing out :)
 
Back
Top