Share via


My.Computer.Clipboard.GetDataObject Method

Retrieves data from the Clipboard as an IDataObject.

' Usage
Dim value As System.Windows.Forms.IDataObject = My.Computer.Clipboard.GetDataObject()
' Declaration
Public Function GetDataObject() As System.Windows.Forms.IDataObject

Return Value

IDataObject

Remarks

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

Example

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.

Requirements

Namespace:Microsoft.VisualBasic.MyServices

Class:ClipboardProxy (provides access to Clipboard)

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

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

Permissions

No permissions are required.

See Also

Reference

My.Computer.Clipboard Object

System.Windows.Forms.IDataObject

Clipboard.GetDataObject

My.Computer.Clipboard.ContainsData Method

My.Computer.Clipboard.GetData Method

My.Computer.Clipboard.SetData Method

My.Computer.Clipboard.SetDataObject Method

Other Resources

Storing Data to and Reading From the Clipboard