Hi can any one give a solution.

I want a program in c# where in a form two text boxes will be there.

1) if we give or write some input in 1st text box it should be stored in a text file and in second text box the input given should be displayed.

I am bit new to c#.I tried a lot .Please can any one give the solution for me in c# windows application

9 Years
Discussion Span
Last Post by scru

The following will save what you have in your first text box (textBox1) to a text file in your Bin/Debug directory. The 2nd piece of code will then read that text file and put the output into the 2nd textbox (textBox2):

Save your text to file

System.IO.StreamWriter StreamWriter1 =
                new System.IO.StreamWriter("yourFile.txt");

Read your file to the new text box

System.IO.StreamReader StreamReader1 =
            new System.IO.StreamReader("yourFile.txt");
            String text = StreamReader1.ReadToEnd();
textBox2.Text = text;

I hope this helps :)


Is there a special reason you want to display the text the user entered in textbox1 in textbox2 using a streamreader?

You could do this very easily, without having to use a streamreader, just by assigning the value of the textbox1.Text property to the textbox2.Text property.

textBox2.Text = textbox1.Text;

Hi friend ,
Thanks a lot it is working fine.

Can you suggest me some best sites to learn c# in short time as I am working in a support project i require it to learn as soon as possible.

Waiting for your Valuable Suggestion,



Remember if you do try and learn it quickly you will only be good at the basics, if you want to be good at C# its best to invest time and money in proper materials.

What are the best ways to invest and spend time to be a good c# programmer.Can you give some snapshot points which i can implement daily so that i not only learn but become good c#programmer.

I think reputation is most valuable fee than anything which you r presently getting a lot "King".

Edited by mike_2000_17: Fixed formatting


I want to develop some programs using windows application rather than at a command prompt application.So, is the given site has some tutorials quoting windows application programs??:-|


Best thing to do is take courses or buy as many books as you can. All depends what you want to do if I am honest, C# is a broad subject so if you know what type of applications you want to make then you should buy books on it (which are generally not very cheap).

That site does have Win App tutorials. All books etc will go through Console examples first as that is the basics of the language, you need to master the basics before trying more complex things. That site also goes into detail on other things you can do such as drawing, graphics etc.


Thanks so i will start learning with console part friend


Theres this book "Micrsoft Visual C# Express 2005 for the absolute beginner" by Premier Press that delves right into Windows app programming that I found quite easy to follow. However, by the ned of he book, all you'll really know is the basics. It's a good introductory course.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.