Read a Text File - Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

The following code is used to write some text from a TextBox to to a text file.

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

If the text file you writing to exists, you can chose to keep it's content or clear it by setting the last parameter: True: Keep the original contents in the text file
False: Overwrite the text in the text file.

If the file doesn't exist, it will be created and named as you specified already in the first parameter.

Share This

Home | About | Contact | Privacy Policy

Copyright 2018 - All Rights Reserved.