Stream writer newline problem

I have a program where the contents of a text box are written to a text file. The text contents contain many new lines (\r\n). If I set the contents of the text box to:

textBox1 -> Text = "Test 1\r\nTest 2\r\nTest3"

The text box text will appear as:

Test 1
Test 2
Test 3

Now when I pass the textbox text through a stream writer to a dialog's file name using this:

StreamWriter^ SaveMyText = gcnew StreamWriter(saveFileDialog1 -> FileName);
SaveMyText -> Write(textBox1 -> Text);
SaveMyText -> Close();

The text file contains the text:


My question is how would I be able to print the contents of a text box that have new lines in them?

Thank you.
Last edited on
This will get a lot more help if it is in the windows section rather than general c++. You should try moving it by editing the post.
It looks like it should work to me.

Maybe try the WriteLine() function I haven't done any c++/cli so I won't be of much help.

Last edited on
Topic archived. No new replies allowed.