Bewerken

Delen via


ClipboardProxy.GetText Method

Definition

Retrieves text from the Clipboard.

Overloads

GetText()

Retrieves text from the Clipboard.

GetText(TextDataFormat)

Retrieves text from the Clipboard.

GetText()

Retrieves text from the Clipboard.

public:
 System::String ^ GetText();
public string GetText ();
member this.GetText : unit -> string
Public Function GetText () As String

Returns

The Clipboard text data or an empty string if the Clipboard does not contain data in the Text or UnicodeText format, depending on the operating system.

Examples

This example reads text from the Clipboard into the string textOnClipboard.

Dim textOnClipboard As String = My.Computer.Clipboard.GetText()

This example fails if there is no text on the Clipboard.

Remarks

Possible formats are CommaSeparatedValue, Html, Rtf and UnicodeText.

Availability by Project Type

Project type Available
Windows Application Yes
Class Library Yes
Console Application Yes
Windows Control Library Yes
Web Control Library No
Windows Service Yes
Web Site No

See also

Applies to

GetText(TextDataFormat)

Retrieves text from the Clipboard.

public:
 System::String ^ GetText(System::Windows::Forms::TextDataFormat format);
public string GetText (System.Windows.Forms.TextDataFormat format);
member this.GetText : System.Windows.Forms.TextDataFormat -> string
Public Function GetText (format As TextDataFormat) As String

Parameters

format
TextDataFormat

TextDataFormat. If specified, identifies what text format should be retrieved. Default is CommaSeparatedValue. Required.

Returns

The Clipboard text data or an empty string if the Clipboard does not contain data in the specified format.

Examples

This example reads text from the Clipboard into the string textOnClipboard.

Dim textOnClipboard As String = My.Computer.Clipboard.GetText()

This example fails if there is no text on the Clipboard.

Remarks

Possible formats are CommaSeparatedValue, Html, Rtf and UnicodeText.

Availability by Project Type

Project type Available
Windows Application Yes
Class Library Yes
Console Application Yes
Windows Control Library Yes
Web Control Library No
Windows Service Yes
Web Site No

See also

Applies to