共用方式為


My.Computer.Clipboard.GetData Method 

Retrieves data in a custom format from the Clipboard.

' Usage
Dim value As Object = My.Computer.Clipboard.GetData(format)
' Declaration
Public Function GetData( _
   ByVal format As String _
) As Object

Parameters

  • format
    String. Name of the data format. Required.

Return Value

Object.

Remarks

Example

This example reads data in the format specialformat from the Clipboard and writes it to file.

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

Replace specialformat with the custom data format you wish to retrieve.

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
My.Computer.Clipboard.ContainsData Method
My.Computer.Clipboard.GetDataObject Method
My.Computer.Clipboard.SetData Method
My.Computer.Clipboard.SetDataObject Method
GetData

Other Resources

Storing Data to and Reading From the Clipboard