TextBoxBase.Copy Method

Copies the current selection of the text editing control to the Clipboard.

Namespace: System.Windows.Controls.Primitives
Assembly: PresentationFramework (in presentationframework.dll)

public void Copy ()
public void Copy ()
public function Copy ()
You cannot use methods in XAML.

A copy operation copies the selected text to the Clipboard. Note that the selected text is not removed from the text editing control in the process. A similar method, Cut, moves the current selection to the Clipboard and removes the selected text from the text editing control in the process.

The following example demonstrates how to use the Copy method to copy the text that is selected within a TextBox control.

private void copyText(object sender, RoutedEventArgs e)
{
    myTextBox.Copy();
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

ADD
Show: