Append Text with StreamWriter VB.Net

~OSD~ 2,201 Reputation points
2022-09-29T11:09:14.807+00:00

Hi,

I am writing text to a text file using StreamWriter, it do the work as expected but I am wondering if the text can be Appended instead of overwritting?

'Save value into text file  
                    '  
                    Dim objWriter As New System.IO.StreamWriter(TxtFile, False)  
                    objWriter.WriteLine(TxtFile.ToString)  
                    objWriter.Close()  
                    '  
Developer technologies | VB
Developer technologies | Visual Studio | Other
Developer technologies | Visual Studio | Other
A family of Microsoft suites of integrated development tools for building applications for Windows, the web, mobile devices and many other platforms. Miscellaneous topics that do not fit into specific categories.
{count} votes

Answer accepted by question author
  1. LesHay 7,146 Reputation points
    2022-09-29T14:05:43.777+00:00

    Hi
    Try changing the second parameter to True. While you are typing the code for that line, when you add the comma after 'txtfile', then when you press space, you should get a pop up balloon with helpful information. In this case you will likely get 3 of 8, if you use the little down arrow onto 4 of 8, red the help text and maybe you will see what you want.

    Dim objWriter As New System.IO.StreamWriter(TxtFile, True)  
    
    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.