Find Method

Object List Next Object

Defined By:
RichTextBox

Description:

Searches for a specified string in the text contained in a RichTextBox control.

Declaration:

Function Find(ByVal searchString As String, ByVal startChar As Long, ByVal endChar As Long, ByVal options As Long) As Long

Details:

Settings for the options argument includes: 2 - WholeWord, 4 - MatchCase, and 8 - NoHighlight. To combine options, either add their values together or use the Or operator.

If the specified search text is found, the Find method first highlights it, then returns the index of the first character in the highlighted string. The Find method returns a -1, if the specified search text is not found.

The search behavior of the Find method is dependent on the values for startChar and endChar.