Display an Image stored in Clipboard - Visual Basic .NET
Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013
This is a tutorial on how to get the image stored in the clipboard and display it in a picture box in visual basic .net
There are situations when you need to display an image copied from a website, or a local folder and displays it in a picture box.
You can do that by accessing the clipboard from your visual basic .net application.
Clipboard usually contains more than just images of course. It can store text, tables, folders, files etc...
So before you go ahead and paste the image into the picture you want to make sure that the current clipboard data is indeed an image.
That is actually pretty easy to accomplish in visual basic .net
Below is the code that checks the clipboard if it has in image, and then paste it in the picture box if the condition is true
If My.Computer.Clipboard.ContainsImage Then PictureBox1.Image = My.Computer.Clipboard.GetImage End If
Optional: You can clear the image from the clipboard by adding the following code: