richtextbox escape characters

How do I read tabs and newlines from a richtextbox

For instance, I would like to do the following:

richTextBox.Text.Replace("\n", "<br>");

But it is not picking up \n as a character in the richtextbox.

Thanks




Answer this question

richtextbox escape characters

  • Montana16

    The Replace method return the result in a string. So, change your code to this and it will word:


    richtTextBox.Text = richTextBox.Text.Replace("\n", "<br>");



  • richtextbox escape characters