This article about Save Text File C# Example using System.IO.File,These examples show various ways to write text to a file. The first two examples use static convenience methods on the System.IO.File class to write each element of any IEnumerable<string> and a string to a text file. Example  shows how to add text to a file when you have to process each line individually as you write to the file. Examples overwrite all existing content in the file, but example shows you how to append text to an existing file.

These examples all write string literals to files, but more likely you will want to use the Format method, which has many controls for writing different types of values right or left justified in a field, with or without padding, and so on.

Let’s to make program how to write text file C# windows form, follow the steps to make it:

  1. Create a new application project. In Visual Studio, on the menu click File> New  > Project. For more details, see the following menu on the display.


  1. Then will appear the window New Project like the look below


  1. Write down the name of the project that will be created on a field Name. Specify the directory storage project by accessing the field Location. Next, give the name of the solution in the Solution Name. Then click OK.


  1. Create a new windows form like the below


  1. Next step, Back to windows form and view code to write the following program listing:

  1. After you write down the program listings, press the F5 key to run the program and if you successfull the result is :


  1. Fill the textbox then click button “Save File”, so the result will save file to your directory application path like the below:



We have explained how to make a simple program with save text file dialog C# using visual studio 2010 and mysql, for those of you who want to download the source code of the program also can. Hopefully this discussion is helpful to you.

You can see Save Text File C# Example from Github project in Here.

Thank you for reading this article about Save Text File C# Example, I hope this article is useful for you. Visit My Github about .Net Csharp in Here

Save Text File C# Example
Tagged on:             

Leave a Reply

Your email address will not be published. Required fields are marked *