StreamWriter Help - Start on EndLine NOT Beginning

Diablicolic

Well-known member
Joined
Jul 28, 2003
Messages
168
Location
Your Neighbor
I want to edit Log.txt within my startup path. But when I edit the Log.txt, it always starts at line 1, when I want the editing to start at the end line (where there is no text).

This is on the top for the streamwriter:

[VB]
Private LogEditor As New System.IO.StreamWriter(Application.StartupPath & "/Log.txt")
[/VB]

And then in my Load Form I got this:

[VB]
LogEditor.Write("Eradication Logs on...")
LogEditor.Flush()
[/VB]

This would write Log.txt, but it writes over my previous text that was on Log.txt :mad:

How can I make it so that the StreamWriter starts writing where there is no text?
 
hi,

you could try in your constructor adding the bool true to allow append. The default as your code infers is to overwrite...


Private LogEditor As New System.IO.StreamWriter(Application.StartupPath & "/Log.txt", true)
 
Back
Top