tags:

views:

58

answers:

1

Hello, does anyone know how to load contents of a file into a multilined TextBox in net 2.0 compact framework and, after editing save it back to a file (the same or with changed name)?

I'm a newbee in C# programming :(

Greetings

+2  A: 

Should be just this simple:

// read:
MyTextBox.Text = System.IO.File.ReadAllText("some_file.txt");

// write:
System.IO.File.WriteAllText("some_other_file.txt", MyTextBox.Text);

Though you will want to do some exception handling in your production version. But these two lines of code are your bread and butter.

P.S. Most things that you get to do with the full .NET framework also work in the compact edition. So when you're searching for the "how to", never mind looking compact-specific code at first. Just try the standard .NET offerings.

Paul Sasik
Thank you very much ;) It works perfectly... ;)
Jakis
You're welcome. But don't forget to accept the answer. That's what makes Stack Overflow work so well.
Paul Sasik