Skip to main content

RichEditControl.ShowSearchForm() Method

Invokes the “Find and Replace” dialog.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v23.2.dll

NuGet Packages: DevExpress.Win.PivotGrid, DevExpress.Win.RichEdit, DevExpress.Win.TreeMap

Declaration

public virtual void ShowSearchForm()

Remarks

Use the FindCommand or ReplaceCommand commands to show the Find and Replace dialog.

FindForm

To customize the search form, make a descendant and override the required methods, as shown in the How to: Customize the Search Form document.

To create your own form, use the XtraRichEdit API. It provides the ISearchResult interface which defines methods required to perform a text search in the document.

Example

The following code invokes the Find and Replace dialog switched to the ‘Find’ tab with the word ‘test’ used for search. The current RichEditControl instance is passed to the BarItem.ItemClick event handler using the BarItem.Tag property.

View Example

static void buttonCustomAction_ItemClick_ShowSearchFormMethod(object sender, ItemClickEventArgs e) {
    RichEditControl richEdit = e.Item.Tag as RichEditControl;
    richEdit.ShowSearchForm();
    var searchForm = Application.OpenForms.Cast<Form>().Last() as DevExpress.XtraRichEdit.Forms.SearchTextForm;
    if(searchForm != null) {
        System.Windows.Forms.Control[] searchBoxes = searchForm.Controls.Find("cbFndSearchString", true);
        if(searchBoxes.Length > 0) searchBoxes[0].Text = "test";
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ShowSearchForm() method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also