Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
SelBold, SelItalic, SelStrikethru, SelUnderline Properties
See Also Example Applies To
Return or set font styles of the currently selected text in a RichTextBox control. The font styles include the following formats: Bold, Italic, Strikethru, and Underline. Not available at design time.
Syntax
object.SelBold [= value]
object.SelItalic [= value]
object.SelStrikethru [= value]
object.SelUnderline [= value]
The SelBold, SelItalic, SelStrikethru, and SelUnderline properties syntax has these parts:
Part | Description |
object | An object expression that evaluates to an object in the Applies To list. |
value | A Boolean expression or constant that determines the font style, as described in Settings. |
Settings
The settings for value are:
Setting | Description |
Null | Neither. The selection or character following the insertion point contains characters that have a mix of the appropriate font styles. |
True | All the characters in the selection or character following the insertion point have the appropriate font style. |
False | (Default) None of the characters in the selection or character following the insertion point have the appropriate font style. |
Remarks
These properties behave like the Bold, Italic, Strikethru, and Underline properties of a Font object. The RichTextBox control has a Font property and therefore the ability to apply font styles to all the text in the control through the properties of the control's Font object. Use these properties to apply font styles to selected text or to characters entered at the insertion point.
Typically, you access these properties by creating a toolbar in your application with buttons to toggle these properties individually.
To distinguish between the values of Null and False when reading these properties at run time, use the IsNull function with the If...Then...Else statement. For example:
If IsNull(RichTextBox1.SelBold) = True Then
' Code to run when selection is mixed.
ElseIf RichTextBox1.SelBold = False Then
' Code to run when selection is not bold.
...
End If