Visual Basic: RichTextBox Control

SelCharOffset Property

See Also    Example    Applies To

Returns or sets a value that determines whether text in the RichTextBox control appears on the baseline (normal), as a superscript above the baseline, or as a subscript below the baseline. Not available at design time.

Syntax

object.SelCharOffset [= offset]

The SelCharOffset property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
offset An integer that determines how far the characters in the current selection or that following the insertion point are offset from the baseline of the text, as described in Settings.

Settings

The settings for offset are:

Setting Description
Null Neither. The selection has a mix of characters with different offsets.
0 (Default) Normal. The characters all appear on the normal text baseline.
Positive integer Superscript. The characters appear above the baseline by the number of twips specified.
Negative integer Subscript. The characters appear below the baseline by the number of twips specified.

Remarks

To distinguish between the values of Null and 0 when reading this property at run time, use the IsNull function with the If...Then...Else statement. For example:

If IsNull(RichTextBox1.SelCharOffset) = True Then
   ' Code to run when selection is mixed.
ElseIf RichTextBox1.SelCharOffset = 0 Then
   ' Code to run when selection is all on the baseline.
...
End If