Keep getting a new line, not sure why

This program I'm working on is supposed to replace all occurrences of a string-1 (user defined) with a preferred string-2 (user defined).

1
2
3
//tb = a richTextBox, I just shorten it to make coding less tedious.
tb1->Rtf = tb1->Rft->Replace (tb2->Rtf, tb3->Rtf);


I would like to keep it as "Rtf" instead of "Text", because I don't want to lose the format (colors, font, etc).

However the output always produces a newline, and I can't seem to get rid of it.

Example Only:
1
2
3
4
5
6
//tb1 = "Hey World"
//tb2 = "Hey"
//tb3 = "Hello"
//-----------------
//This code is meant to replace "Hey" with "Hello". 
//However, it gives a new line, like below: 


1
2
Hello
World

Last edited on
also, I've tried removing the new line but can't seem to do so

These are what I've tried:

1
2
3
4
5

tb1->Rtf->Replace(tb3->Rtf + "\r\n", "");
tb1->Rtf->Replace(tb3->Rtf + "\n", "");
tb1->Rtf->Replace(tb3->Rtf + "\r", "");
tb1->Rtf->Replace(tb3->Rtf + "\n\r", "");
Last edited on
Topic archived. No new replies allowed.