howtothings.co.uk

Full Version: Write textbox text to a text file [VB.NET]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In this tutorial I am going to show you how to write text to a file from TextBox. For example, you have some text in TextBox you want to save on your computer, you can do it by creating a text file.

The code is:

Code:
My.Computer.FileSystem.WriteAllText("C:\location\file.txt", TextBox1.Text, True)

Replace "C:\location\file.txt" with the location where the file should be created. It must be a .txt extension! Smile

True -> means it won't overwrite if the file is already existing. It'll keep original content.
False -> means if the file already exists, it will overwrite it.

Enjoy.
Doesn't need to be .txt at all..
Aye! Linux looks for a magic number!