|
-
December 2nd, 2009, 07:20 PM
#1
MultiLine Textboxes??
Hi!
I am programming in C# for a class. I am using visual studio 2008 with .NET 3.5. I have a multiline textbox on a form but I can't get it to use newlines (\n). Is there some magic way to insert a new line into a textbox? Is there a better control to use? I want it to output like a console.
-
December 2nd, 2009, 07:22 PM
#2
Re: MultiLine Textboxes??
One, newlines on Windows are not \n, they are \r\n. Two, I'm not sure what you mean by "I can't get it to use newlines". Can you be more specific?
-
December 2nd, 2009, 07:25 PM
#3
Re: MultiLine Textboxes??
My code for the box looks like this
Output.Text += "Starting New Run!!! \n";
How ever. It ignores the newline. It should print
Starting new run!
Starting new run!
Starting new run!
instead it prints
Starting new run!Starting new run!Starting new run!
-
December 2nd, 2009, 07:31 PM
#4
Re: MultiLine Textboxes??
NEVERMIND! You solved it thanks!
-
December 2nd, 2009, 07:54 PM
#5
Re: MultiLine Textboxes??
While \r\n will work, the preferred way would be using Enviroment.NewLine which makes sure it will be handled correctly in the future
-
December 3rd, 2009, 02:10 AM
#6
Re: MultiLine Textboxes??
 Originally Posted by ixilom
While \r\n will work, the preferred way would be using Enviroment.NewLine which makes sure it will be handled correctly in the future 
Yes, absolutely correct. And it will also come in handy should you ever port your code to Mono.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|