JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Accessing Text in a Rich Text Box

To access text in a rich text box, you can use two properties: Text and Rtf. As their names imply, Text holds the text in a rich text box in plain text format (like a text box), and Rtf holds the text in rich text format.

Here's an example where we read the text in RichTextBox1 without any RTF codes and display that text as plain text in RichTextBox2:

Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button1.Click
    RichTextBox2.Text = RichTextBox1.Text
End Sub

Here's the same operation where we transfer the text including all RTF codes-that is, here we're transferring rich text from one rich text box to another:

Private Sub Button1_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles Button2.Click
    RichTextBox2.Rtf = RichTextBox1.Rtf
End Sub
Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor