Write To Text File Using Streamwriter C

Posted on
Write To Text File Using Streamwriter C Average ratng: 6,4/10 8911 votes
  1. Python Write To Text File
  2. Vba Write To Text File

I'd like to add new line with text to my date.txt file, but instead of adding it into existing date.txt, app is creating new date.txt file.

Nov 09, 2010  Im trying to create simple program with C-sharp using visual studio 2010 that reads text from text file,prints that to box, this part i done, and after that can pick line and add to that line new text, example: First line Second line.

I'd like to open txt file, add some text, close it, and later after clicking something: open date.txt, add text, and close it again.

So i can get:

Button pressed: txt opened -> added current time, then close it. Another button pressed, txt opened -> added text 'OK', or 'NOT OK' in the same line, then close it again.

So my txt file will look like that:

How can i do this? Thanks!

Streamwriter
ElfocElfoc

4 Answers

Python Write To Text File

You could do it easily using

Managing successful projects with prince 2. If you need newline

Anyway if you need your code do this:

with second parameter telling to append to file.
Check here StreamWriter syntax.

Vba Write To Text File

MarcoMarco
AskenAsken

Why not do it with one method call:

which will do the newline for you, and allow you to insert multiple lines at once if you want.

Write
kad81kad81
MehdiMehdi

Not the answer you're looking for? Browse other questions tagged c#winformsstreamtext-files or ask your own question.