Appending Contents of two RichTextbox as a single RichText string

前端 未结 4 1729
难免孤独
难免孤独 2020-12-11 16:02

I want to append the contents of two rich text boxes in a Windows Forms .Net application; say: stringText = richtextbox1.Rtf + richtextbox2.Rtf; The strin

4条回答
  •  余生分开走
    2020-12-11 16:21

    I know it's old question, but it seems to be a common one. Thus, I'm gonna add my answer to this, cause the marked answer make RTF's to concatenate, but it also gives an extra new line, every time.

    This would be:

    RichTextBoxSource.Select(0,RichTextBoxSource.TextLength);
    RichTextBoxTarget.SelectedRtf = richTextBoxSource.SelectedRtf;
    

    It's easy and works fine. Hope it will help somebody:)

提交回复
热议问题