Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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..
It's not impossible, it's Inevitable.
  • *Experts*
Posted

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.

Dim wr As New IO.StreamWriter("file path", False)
'dont forget to close the stream
wr.Close()

Posted
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.

Dim wr As New IO.StreamWriter("file path", False)
'dont forget to close the stream
wr.Close()

 

 

Thanks, I'm starting to figure this thing out :)

It's not impossible, it's Inevitable.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...