Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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:

 

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

 

And then in my Load Form I got this:

 

          LogEditor.Write("Eradication Logs on...")
           LogEditor.Flush()

 

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?

"Reality is fake, Dreams are for real"
Posted

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)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...