Richtextbox text

How can I display a text document within a richtextbox and it honor the line returns.  I have a document formatted like so:

"This is line 1\nthis is line2\nthis is line 3\tthis is a tab\nthis is line 4";

How can I display this string appropriately within a form.  Preferrably using a richtextbox.

Thanks,
Kendal
gvector1Asked:
Who is Participating?
 
AaronReamsConnect With a Mentor Commented:
Hi gvector1,

By default, the richeditbox should accept \n and insert a line return in its place.  

input
-------
            string s = "This is line 1\nthis is line2\nthis is line 3\tthis is a tab\nthis is line 4";
            richTextBox1.Text = s;

output
-----
This is line 1
this is line2
this is line 3    this is a tab
this is line 4

Is that not working for you?


Regards -A.R
0
 
ptmcompCommented:
What is your Richtextbox displaying?
0
 
gvector1Author Commented:
Thank you all.  It was my fault.  I didn't realize until A.R's sample what I was doing wrong.  I was using @ in front of the string.  Once I removed @, it worked fine.  Thanks for the assistance.
0
 
AaronReamsCommented:
No problem.   Cheers -A.R.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.