Back to Devexpress

RichEditControl.Copy() Method

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

latest3.7 KB
Original Source

RichEditControl.Copy() Method

Copies the content of the selection to the Clipboard.

Namespace : DevExpress.XtraRichEdit

Assembly : DevExpress.XtraRichEdit.v25.2.dll

NuGet Package : DevExpress.Win.RichEdit

Declaration

csharp
public void Copy()
vb
Public Sub Copy

Example

The following code finds all occurrences of the “text from RichEditControl” phrase using the SubDocument.FindAll method, selects and copies them.

View Example

csharp
richEditControl.Text = "Open any text editor (Notepad, Word) and press the 'Ctrl+V' shortcut, the 'text from RichEditControl' string will be pasted into the editor's document";
DocumentRange[] foundRanges = richEditControl.Document.FindAll("text from RichEditControl", SearchOptions.None);
richEditControl.Document.Selection = foundRanges[0];
richEditControl.Copy();
vb
richEditControl.Text = "Open any text editor (Notepad, Word) and press the 'Ctrl+V' shortcut, the 'text from RichEditControl' string will be pasted into the editor's document"
Dim foundedRanges() As DocumentRange = richEditControl.Document.FindAll("text from RichEditControl", SearchOptions.None)
richEditControl.Document.Selection = foundedRanges(0)
richEditControl.Copy()

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

csharp
richEditControl.Document.Selection = foundRanges[0];
richEditControl.Copy();
#endregion #CopySelectedText

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

vb
richEditControl.Document.Selection = foundedRanges(0)
            richEditControl.Copy()
' #End Region ' #CopySelectedText

See Also

Paste()

Cut()

CopySelectionCommand

RichEditControl Class

RichEditControl Members

DevExpress.XtraRichEdit Namespace