ClipboardProxy.GetText Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
- Computer
- TextDataFormat
- GetText
- ContainsText
- SetText
- Objects (Visual Basic)
- Storing Data to and Reading from the Clipboard (Visual Basic)
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
- Computer
- TextDataFormat
- GetText
- ContainsText
- SetText
- Objects (Visual Basic)
- Storing Data to and Reading from the Clipboard (Visual Basic)