Share via


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

The My.Computer.Clipboard.GetImage method allows you to retrieve an image from the Clipboard.

Items placed on the Clipboard will persist even after the application is shut down.

To retrieve an image from the Clipboard

  • Use the My.Computer.Clipboard.GetImage method to retrieve an image from the Clipboard. 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
    

See Also

Tasks

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

Reference

My.Computer.Clipboard Object

My.Computer.Clipboard Object Members

My.Computer.Clipboard.ContainsImage Method

My.Computer.Clipboard.GetImage Method