How to Read and Write to Text File – C# Tutorial Visual Studio 2008


In this tutorial I show you how to read and write to a text file using StreamReader and StreamWriter in C# Visual Studio 2008. Make sure to leave a comment and subscribe to my videos.






  1. Please Explain more what you are doing! A beginner does not understand what he/she is coding.
    A tutorial is for learning, this is just copy paste…

  2. Thank you for this video, It's a Big help to me Kudos!
    P.S. Apologize for my poor English because It's not my native language

  3. Thanks man, but I seriously can't find anything on how to append a string to a specific line within the Text File. Every method adds the string to the end of the file?
    Even a link would be greatly appreciated..?

  4. Next time please go over what you are typing other wise it will not make since that idea of youtube is to put it in the most basic language for anyone to us

  5. Thanks. I used this to help me figure a way to save the info i have in the Text Box's as a file. However, I do not know how to make it save it as a .txt file. It just saves it as a file with no extension. If i add the .txt extension it works. but i do not want to have to add the extension manually each time. Let me know if u find a fix for it.

  6. Hello there… thanks for this nice tutorial ! it was very helpful. but i have a question:
    i saw that if i have in my file 2 lines with some text, when i am trying to write to another file, it writes those 2 lines on ONE single line… i even tried with WriteLine in order to append an new line, but this happens only when finishing writing, then it appends an new line (enter)… can you please help me with this… Many thanks in advance !!!

  7. awesome job, also i was wondering can you develop a video where you can show how to export data from datagridview to an excel or csv or even txt file in c# microsoft visual 2008. it would help me a lot 🙂 . thanks

  8. Going to try this. I am trying to have an app read data file a text file that has delimiters and place into an excel or database. I got my head wrapped around programming but I am missing a lot of the mechanics still. Maybe this vid can give me pointers. I've been trying just to get the app to just read one text file and print to console and that is giving me problems. 🙂

  9. @EpilepticElbow

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Security.
    using System.Net.Mail;
    using System.IO; <—————————————

    place this at the top

  10. By mistake I ended up watching this tutorial, and i found it soo good that it got me interested in C#. Great tutorial thnkz a lot


Please enter your comment!
Please enter your name here