Escape characters in RichTextBox....

  • Thread starter Thread starter Sinex
  • Start date Start date
S

Sinex

Hi !
I have a form. The form has a textbox and a richtextbox.
There is a button also. When the button is clicked,
whatever text was typed into the text box, must be copied
to the richtextbox.

At runtime, I enter the following string into the text
box:
Hi\nHello\nHow\nDo\nYou\nDo

Then I click the button. In the richtextbox I am expecting
Hi
Hello
How
Do
You
Do

But what I get is:
Hi\nHello\nHow\nDo\nYou\nDo


Ne idea to workaround this probs?

....Sinex
 
When entered through the keyboard as text into the control, they are not
escape characters -- they are just regular characters. So what you see is
expected. Are you looking to create code that will treat text as something
to parse and thus will treat the backslash as a character escaping function
generically?
 
-----Original Message-----
Hi !
I have a form. The form has a textbox and a richtextbox.
There is a button also. When the button is clicked,
whatever text was typed into the text box, must be copied
to the richtextbox.

At runtime, I enter the following string into the text
box:
Hi\nHello\nHow\nDo\nYou\nDo

Then I click the button. In the richtextbox I am expecting
Hi
Hello
How
Do
You
Do

But what I get is:
Hi\nHello\nHow\nDo\nYou\nDo


Ne idea to workaround this probs?

....Sinex
.
use

String s1=Regex.Unescape(textBox1.Text);

and put s1 in your RichTextBox
 
Back
Top