11-11-2011, 04:15 PM
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:
Replace "C:\location\file.txt" with the location where the file should be created. It must be a .txt extension!
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.
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!
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.