Share via


My.Computer.Clipboard.GetImage Method

Retrieves an image from the Clipboard.

' Usage
Dim value As System.Drawing.Image = My.Computer.Clipboard.GetImage()
' Declaration
Public Function GetImage() As System.Drawing.Image

Return Value

Image

Remarks

The GetImage method will return Nothing if there is no data on the Clipboard that is an image.

The method requires AllClipboard.

Tasks

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

To

See

Retrieve an image from the Clipboard

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 before retrieving it and assigning 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

For this example to function correctly, there must be a PictureBox named PictureBox1 on your form.

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

Tasks

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

Reference

My.Computer.Clipboard Object

System.Drawing.Image

Clipboard.GetImage

My.Computer.Clipboard.ContainsImage Method

My.Computer.Clipboard.SetImage Method