RichEditControl.ShowSearchForm() Method

Invokes the "Find and Replace" dialog.

Namespace: DevExpress.XtraRichEdit

Assembly: DevExpress.XtraRichEdit.v20.1.dll

Declaration

public virtual void ShowSearchForm()
Public Overridable Sub 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.

Examples

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.

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

Implements

See Also