Find

Description

Finds data in a DataWindow control or DataStore, or text in a RichTextEdit control or RichTextEdit DataWindow or DataStore.

You can specify search direction and whether to match whole words and case. Finds the specified text in the control and highlights the text if found.

For syntax for DataWindows and DataStores, see the Find method for DataWindows in the section called “Find” in DataWindow Reference.

Applies to

RichTextEdit controls and DataWindow controls (or DataStore objects) whose content has the RichTextEdit presentation style

Syntax

controlname.Find ( searchtext, forward, insensitive, wholeword, cursor )

Argument

Description

controlname

The name of the RichTextEdit, DataWindow control, or DataStore whose contents you want to search.

searchtext

A string whose value is the text you want to find. For the RichTextEdit control, searchtext is limited to 99 characters.

forward

A boolean value indicating the direction you want to search. Values are:

  • TRUE -- The search proceeds forward from the cursor position or, if cursor is false, from the start of the document.

  • FALSE -- The search proceeds backward from the cursor position or, if cursor is false, from the end of the document.

insensitive

A boolean value indicating the search string and the found text must match case. Values are:

  • TRUE -- The search is not sensitive to case.

  • FALSE -- The search is case-sensitive.

wholeword

A boolean value indicating that the found text must be a whole word. Values are:

  • TRUE -- The found text must be a whole word.

  • FALSE -- The found text can be a partial word.

cursor

A boolean value indicating where the search begins. Values are:

  • TRUE -- The search begins at the cursor position.

  • FALSE -- The search begins at the start of the document if  forward is true or at the end if  forward is false.


Return value

Integer.

Returns the number of characters found. Find returns 0 if no matching text is found, and returns -1 if the DataWindow's presentation style is not RichTextEdit or an error occurs.

Examples

This example searches the RichTextEdit rte_1 for text the user specifies in the SingleLineEdit sle_search. The search proceeds forward from the cursor position. The search is case insensitive and not limited to whole words:

integer li_charsfound
li_charsfound = rte_1.Find(sle_search.Text, &
      TRUE, TRUE, FALSE, TRUE)

See also

FindNext