Clipboard.GetData(String) 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 data in a specified format from the Clipboard.
public:
static System::Object ^ GetData(System::String ^ format);
public static object GetData (string format);
static member GetData : string -> obj
Public Shared Function GetData (format As String) As Object
Parameters
- format
- String
A string that specifies the format of the data to retrieve. For a set of predefined data formats, see the DataFormats class.
Returns
An object that contains the data in the specified format, or null
if the data is unavailable in the specified format.
Exceptions
format
is null
.
Examples
The following example demonstrates the use of this method.
// After this line executes, IsHTMLDataOnClipboard will be true if
// HTML data is available natively on the clipboard; if not, it
// will be false.
bool IsHTMLDataOnClipboard = Clipboard.ContainsData(DataFormats.Html);
// If there is HTML data on the clipboard, retrieve it.
string htmlData;
if(IsHTMLDataOnClipboard)
{
htmlData = Clipboard.GetText(TextDataFormat.Html);
}
' After this line executes, IsHTMLDataOnClipboard will be true if
' HTML data is available natively on the clipboard; if not, it
' will be false.
Dim IsHTMLDataOnClipboard As Boolean = Clipboard.ContainsData(DataFormats.Html)
' If there is HTML data on the clipboard, retrieve it.
Dim htmlData As String
If IsHTMLDataOnClipboard Then
htmlData = Clipboard.GetText(TextDataFormat.Html)
End If
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET