Clipboard.GetData(String) Método

Definición

Recupera los datos con un formato especificado desde el Portapapeles.

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

Parámetros

format
String

Cadena que especifica el formato de los datos que se van a recuperar. Para ver un conjunto de formatos de datos predefinidos, consulte la clase DataFormats.

Devoluciones

Objeto que contiene los datos en el formato especificado o su valor es null si los datos no están disponibles en el formato especificado.

Excepciones

format es null.

Ejemplos

En el ejemplo siguiente se muestra el uso de este método.


// 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

Se aplica a

Consulte también