ClipboardProxy.GetDataObject Method

Definition

Retrieves data from the Clipboard as an IDataObject.

public:
 System::Windows::Forms::IDataObject ^ GetDataObject();
public System.Windows.Forms.IDataObject GetDataObject ();
member this.GetDataObject : unit -> System.Windows.Forms.IDataObject
Public Function GetDataObject () As IDataObject

Returns

An IDataObject object that represents the data currently on the Clipboard, or Nothing if there is no data on the Clipboard.

Examples

This example reads data from the Clipboard in the form of an IDataObject and then writes it to a file.

Dim someData As Object
someData = My.Computer.Clipboard.GetDataObject()
My.Computer.FileSystem.WriteAllBytes("C:\mylogfile", someData, True)

Replace C:\mylogfile with the name of the file to which you want to write.

Remarks

This is an advanced member; it does not show in IntelliSense unless you click the All tab.

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

Security

UIPermission
AllClipboard permission is required to access the system Clipboard.

Applies to

See also