Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

How to: Append to Text Files in Visual Basic

The WriteAllText method can be used to append to a text file by specifying that the append parameter is set to True.

To append to a text file

  • Use the WriteAllText method, specifying the target file and string to be appended and setting the append parameter to True.

    This example writes the string "This is a test string." to the file named Testfile.txt.

    Dim inputString As String = "This is a test string."
      "C://testfile.txt", inputString, True)

The following conditions may cause an exception:

© 2015 Microsoft