Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
How to: Append to Text Files

How to: Append to Text Files in Visual Basic

The My.Computer.FileSystem.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."
    My.Computer.FileSystem.WriteAllText _
    ("C://testfile.txt", inputString, True)

The following conditions may cause an exception:

Community Additions

© 2015 Microsoft