Share via


My.Computer.Clipboard.ContainsImage Method

Returns a Boolean indicating whether an image is stored on the Clipboard.

' Usage
Dim value As Boolean = My.Computer.Clipboard.ContainsImage()
' Declaration
Public Function ContainsImage() As Boolean

Return Value

True if an image is stored on the Clipboard; otherwise False.

Exceptions

This method throws no exceptions.

Remarks

The method requires AllClipboard.

Tasks

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

To

See

Determine whether the Clipboard contains an image

How to: Retrieve an Image from the Clipboard in Visual Basic

Example

This example checks to see if there is an image on the Clipboard and, if so, gets the image and adds it to PictureBox1.

If My.Computer.Clipboard.ContainsImage() Then 
   Dim grabpicture As System.Drawing.Image
   grabpicture = My.Computer.Clipboard.GetImage()
   PictureBox1.Image = grabpicture
End If

This example depends on the existence of a PictureBox named PictureBox1.

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

Clipboard.ContainsImage

My.Computer.Clipboard.GetImage Method

My.Computer.Clipboard.SetImage Method

Other Resources

Storing Data to and Reading From the Clipboard