Search code examples
c#.netrichtextboxbold

How to move bold text to another richtextbox?


Okay, I will just leave my code here.

As you can see from that code, there is a button to make text bold, but not the whole text, just next things user is going to write.

For instance, when user types abc, clicks the button, types def: he gets: abc def.

But, when use: richtextbox2.text = richtextbox1.text;, richtextbox2.text value becomes abcdef, instead of abc def.

I want to copy exact text, including bold text.

Thanks.


Solution

  • use the RTF property of the text box rather than the Text property...

    richtextbox2.Rtf = richtextbox1.Rtf