Find and Replace Dialog in Rich Text Editor
The RichEditControl ships with integrated Find and Replace dialog, shown in the images below.
End users can use the Editing group on the Home ribbon tab to invoke the Find and Replace dialog. Refer to the How to: Create the RichEditControl with a Ribbon UI topic for information on how to add a Ribbon UI to the RichEditControl.
They can also invoke the Find and Replace dialog with a Find tab by pressing CTRL+F and the dialog with a Replace tab by pressing CTRL+H.
Invoke the Dialog in Code
You can use the FindCommand and ReplaceCommand, or RichEditControl.ShowSearchForm and RichEditControl.ShowReplaceForm methods to invoke this dialog. The ShowSearchForm
and ShowReplaceForm
methods trigger the RichEditControl.SearchFormShowing event. You can handle this event to perform actions before a search form is displayed, customize the default Find and Replace dialog (modify captions, set default dialog values, implement custom validation, etc.) or substitute it with a new dialog. Refer to the following document for a dialog replacement example: How to: Customize the Search Form
Tip
Use the SubDocument.ReplaceAll, SubDocument.FindAll, and SubDocument.StartSearch methods or the ISearchResult interface to programmatically search and replace text in a document.