Skip navigation

The clipboard is a set of functions and messages that can be used to transfer data between different windows applications. This is possible since all applications have access to it. We can manipulate data from the Windows clipboard through the .NET framework.

The code sample below shows how to access an image from the clipboard and save it to a file.

We can use the System.Windows.Forms.Clipboard class, which provides methods to save data to the system clipboard and retrieve data from it.

All methods of this class are static, so we don’t have to create an instance of it and everybody has serialized access to it.

The GetDataObject() method is the method that gets all the data from the clipboard.
The other method GetDataPresent()

Given below is the code.

Code of article

'The IDataInterface is used to get the Data

'from the clipboard since it can be in any format

Dim oData As IDataObject

Dim oImg As Image


'The GetDataObject() method is used to get the data

'from the clipboard

If Not IsNothing(Clipboard.GetDataObject) Then

    oData = Clipboard.GetDataObject()

    'The GetDataPresent() method is used to check for

    'a particular format of Data

    If oData.GetDataPresent(DataFormats.Bitmap) Then

        oImg = oData.GetData(DataFormats.Bitmap, True)



        MessageBox.Show("Clipboard data Not an Image")

    End If


    MessageBox.Show("Clipboard has No Data")

End If



Hope this piece of code helps. Happy Coding !!


Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.