My.Computer.Clipboard.ContainsData Method

Indicates whether the Clipboard contains data in the specified custom format.

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

Parameters

  • format
    String. Name of the custom format to be checked. Required.

Return Value

True if data in the specified custom format is stored on the Clipboard; otherwise False.

Exceptions

This method throws no exceptions.

Remarks

If you have placed custom formatted data on the Clipboard, this method allows you to check the Clipboard for data in that format.

Tasks

The following table lists examples of tasks involving the My.Computer.Clipboard.ContainsData method.

To

See

Determine what type of data is stored on the Clipboard

How to: Determine What Type of File is Stored on the Clipboard in Visual Basic

Example

This example checks for data in the custom format specialFormat.

If My.Computer.Clipboard.ContainsData("specialFormat") Then
   MsgBox("Data found.")
End If

Replace specialFormat with the name of the custom format you wish to check.

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

ContainsData

My.Computer.Clipboard.GetData Method

My.Computer.Clipboard.GetDataObject Method

My.Computer.Clipboard.SetData Method

My.Computer.Clipboard.SetDataObject Method

Other Resources

Storing Data to and Reading From the Clipboard