Visual Basic: RichTextBox Control

Visual Studio 6.0

Span Method

See Also    Example    Applies To

Selects text in a RichTextBox control based on a set of specified characters.

Syntax

object.Span characterset, forward, negate

The Span method syntax has these parts:

Part Description
object Required. An object expression that evaluates to an object in the Applies To list.
characterset Required. A string expression that specifies the set of characters to look for when extending the selection, based on the value of negate.
forward Optional. A Boolean expression that determines which direction the insertion point moves, as described in Settings.
negate Optional. A Boolean expression that determines whether the characters in characterset define the set of target characters or are excluded from the set of target characters, as described in Settings.

Settings

The settings for forward are:

Setting Description
True (Default) Selects text from the current insertion point or the beginning of the current selection forward, toward the end of the text.
False Selects text from the current insertion point or the beginning of the current selection backward, toward the start of the text.

The settings for negate are:

Setting Description
True The characters included in the selection are those which do not appear in the characterset argument. The selection stops at the first character found that appears in the characterset argument.
False (Default) The characters included in the selection are those which appear in the characterset argument. The selection stops at the first character found that does not appear in the characterset argument.

Remarks

The Span method is primarily used to easily select a word or sentence in the RichTextBox control.

If the Span method cannot find the specified characters based on the values of the arguments, then the current insertion point or selection remains unchanged.

The Span method does not return any data.

Show: