Skip to main content

RichEditControl.ShowSearchForm() Method

Invokes the “Find and Replace” dialog.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v22.2.dll

NuGet Package: DevExpress.Win.RichEdit

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";
    }
}
See Also