Back to Devexpress

RichEditControl.ShowReplaceForm() Method

windowsforms-devexpress-dot-xtrarichedit-dot-richeditcontrol-db5f9f0a.md

latest4.2 KB
Original Source

RichEditControl.ShowReplaceForm() Method

Invokes the SearchForm dialog switched to the Replace tab.

Namespace : DevExpress.XtraRichEdit

Assembly : DevExpress.XtraRichEdit.v25.2.dll

NuGet Package : DevExpress.Win.RichEdit

Declaration

csharp
public virtual void ShowReplaceForm()
vb
Public Overridable Sub ShowReplaceForm

Remarks

Use the ReplaceCommand to achieve the same result.

Example

The following code invokes the Find and Replace dialog switched to the ‘Replace’ tab and highlights all occurrences of the word ‘button’ in a document. The current RichEditControl instance is passed to the BarItem.ItemClick event handler using the BarItem.Tag property.

View Example

csharp
static void buttonCustomAction_ItemClick_ShowReplaceFormMethod(object sender, ItemClickEventArgs e) {
    RichEditControl richEdit = e.Item.Tag as RichEditControl;
    DocumentRange[] buttonWordRanges = richEdit.Document.FindAll("button", SearchOptions.None);
    richEdit.Document.Selection = buttonWordRanges[0];
    richEdit.ShowReplaceForm();
}
vb
Private Shared Sub buttonCustomAction_ItemClick_ShowReplaceFormMethod(ByVal sender As Object, ByVal e As ItemClickEventArgs)
    Dim richEdit As RichEditControl = TryCast(e.Item.Tag, RichEditControl)
    Dim buttonWordRanges() As DocumentRange = richEdit.Document.FindAll("button", SearchOptions.None)
    richEdit.Document.Selection = buttonWordRanges(0)
    richEdit.ShowReplaceForm()
End Sub

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ShowReplaceForm() 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.

winforms-richeditcontrol-common-api/CS/RichEditAPISample/CodeExamples/RichEditControlActions.cs#L50

csharp
richEdit.Document.Selection = buttonWordRanges[0];
    richEdit.ShowReplaceForm();
}

winforms-richeditcontrol-common-api/VB/RichEditAPISample/CodeExamples/RichEditControlActions.vb#L55

vb
richEdit.Document.Selection = buttonWordRanges(0)
    richEdit.ShowReplaceForm()
End Sub

See Also

ReplaceCommand

ShowSearchForm()

FindCommand

RichEditControl Class

RichEditControl Members

DevExpress.XtraRichEdit Namespace