Export (0) Print
Expand All

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

Community Additions

© 2014 Microsoft