What i want to do, is get the content of a *.Txt file, into a textbox, and if possible retain the formatting.
now, i found this site here: http://weblogs.asp.net/lduveau/archive/2008/03/02/load-a-txt-file-in-a-textbox.aspx That discribes an option 2 where you just add a .txt resources file, and read that to the textbox like this:
txtDisclaimer.Text = Resources.Common.disclaimer_en;
But within my WPF application, the Resources.Common
part does not exist, and thus not work.
Anyone have a clue how it should be done in WPF?
Or can tell me a better way of getting text file content to a textbox ?
You can simply do
txtDisclaimer.Text = File.ReadAllText("Path of your File");
To keep the formatting use the overload
File.ReadAllText Method (String, Encoding)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With