Multiline Textbox

J

Jeff James

I have a multi-line textbox control (i.e.,
TextBox1.MultiLine = true), and I'm trying to force a
series of new line characters to display an address, like
this:

John Doe
123 Main St
Anytown USA

I thought it would be as simple as inserting \n\r (i.e.,
new line, carriage return) into the Text property, like
this...

TextBox1.Text = "John Doe\n\r123 Main St\n\rAnytown USA";

....but this doesn't work. On the PocketPC, the user
actually sees the "\n\r" characters in the textbox. The
same is true for a label control. Is there some way of
forcing a new line?

Other solutions I've tried that don't work...

System.Environment.NewLine <-- CF doesn't support it
Microsoft.CSharp.CrLf <-- CF doesn't support it

I appreciate anyone's help in advance. Hopefully, I'm
overlooking something obvious.

Thanks

Jeff James
 
T

Tim Wilson [MVP]

You had the "\r\n" backwards:

this.textBox1.Multiline = true;
this.textBox1.Text = "John Doe\r\n123 Main St\r\nAnytown USA";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top