|
|
Title | Combine values from two RTF text boxes preserving their formatting properties |
Description | This example shows how to combine values from two RTF text boxes preserving their formatting properties in Visual Basic 6. It uses the controls' SelRTF properties to get their values complete with formatting information. |
Keywords | RTF, Rich Text Box, RichTextBox |
Categories | Controls, Strings |
|
|
If you just use the controls' Text or SelText properties, the result loses all rich formatting.
This example selects the text in each control and uses its SelRTF property to get the text complete with formatting information.
|
|
Private Sub Command1_Click()
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = Len(RichTextBox1.Text)
RichTextBox2.SelStart = 0
RichTextBox2.SelLength = Len(RichTextBox2.Text)
RichTextBox3.SelStart = 0
RichTextBox3.SelLength = Len(RichTextBox3.Text)
RichTextBox3.SelRTF = RichTextBox1.SelRTF
RichTextBox3.SelStart = Len(RichTextBox3.Text)
RichTextBox3.SelLength = 0
RichTextBox3.SelText = vbCrLf
RichTextBox3.SelStart = Len(RichTextBox3.Text)
RichTextBox3.SelLength = 0
RichTextBox3.SelRTF = RichTextBox2.SelRTF
RichTextBox1.SelStart = 0
RichTextBox1.SelLength = 0
RichTextBox2.SelStart = 0
RichTextBox2.SelLength = 0
End Sub
|
|
|
|
|
|