Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 319
  • Last Modified:

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
0
gvector1
Asked:
gvector1
  • 2
1 Solution
 
AaronReamsCommented:
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now