views:

41

answers:

2

Im pretty new to coding, heres my problem.

Results->Text = "G55 > Y" + System::Convert::ToString(destY);

"Results" is a System.Windows.Forms.Textbox "multiline btw", or so says VS.

That line works fine, but i need a "new line or CR" at the end, so that i can repeat that line with different Literals and a different var in ToString.

For days now ive tried different syntax's ive read about, and i cant get it to take any of them.

Or even a complete different way to input text into Results->Text that would allow for tidy multiline use.

Sidenote: since im using ->Text and System::Convert::ToString in VC, would this code be considered just c++ or .net or CLI? to tighten my searches.

A: 

Being completely unfamiliar with .NET, I could be completely wrong, but surely adding a + "\n" to the end of your line would do the job? Or failing that, a + "\r\n"?

Mac
I couldnt get it working, and yes i tried like that i think.->Text doesnt allow it i think.
Smoka
If I recall correctly, having just \n is what confuses the textbox. "\r\n" should work the same as my answer.
Jonathan Allen
+1  A: 

Have you tried System::Environment::NewLine? This will give you CrLf on Windows and whatever is correct for Linux/OS X on those platforms.

Jonathan Allen
yes thank you!->Text = ->Text + System::Environment::NewLine + " new stuff"did the trick!
Smoka