In this article, I will show you how to save data from textbox to text file in windows form using C#.
We write some data in textbox and it will be save in a text file in the given path. Initial chamber Step 1: Open Visual Studio 2010, Go to File, New, Projects, then under Visual C# select Windows. You can change the name of the project and browse your project to different location too. And then press – OK. Now go to any drive, make a folder demo and save a demo.txt file. Design chamber Step 2: Now open your Form1.cs file, where we create our design for inserting data into Text File. We will drag one Textbox and a button to Form1.cs. You will see your Form look like this. Form1.cs [design]: Change the property of textbox - Multiline as True. Code chamber Right click on the blank part of Form1.cs and View Code. You will see you are entered in the code part of the form. Write the following code and then Press F5 to run the project. Form1.cs:
Programming Windows Common Dialogs with Visual C# 2010