Share via


Visual Basic: RichTextBox Control

SelColor Property Example

This example displays a color dialog box from a CommonDialog control to specify the color of selected text in a RichTextBox control. To try this example, put a RichTextBox control, a CommandButton control, and a CommonDialog control on a form. Paste this code into the Click event of the CommandButton control. Then run the example.

  Private Sub Command1_Click()
   CommonDialog1.ShowColor
   RichTextBox1.SelColor = CommonDialog1.Color
End Sub