none
get image from clipboard RRS feed

  • Question

  • My issue is with this code below, i always get an exception saying there is no image in clipboard although i know there is, thanks in advance.

    Try
                If My.Computer.Clipboard.ContainsImage() Then
                    Dim ClipImage As System.Drawing.Image
                    ClipImage = My.Computer.Clipboard.GetImage
                    Me.BackgroundImage = ClipImage
                Else
                    MsgBox("No Images in ClipBoard")
                End If
            Catch ex As Exception
                MsgBox(ex.Message)
    End Try


    P.Clegg

    Saturday, April 19, 2014 1:53 AM

Answers

  • Are you sure that the Clipboard contains an image instead of just a file path? Try pasting into other programs, Paint for example.

    If you mean files, then see My.Computer.Clipboard.ContainsFileDropList, My.Computer.Clipboard.GetFileDropList()(0) and Image.FormFile.


    • Marked as answer by Philip Clegg Saturday, April 19, 2014 9:50 AM
    Saturday, April 19, 2014 7:46 AM

All replies

  • Are you sure that the Clipboard contains an image instead of just a file path? Try pasting into other programs, Paint for example.

    If you mean files, then see My.Computer.Clipboard.ContainsFileDropList, My.Computer.Clipboard.GetFileDropList()(0) and Image.FormFile.


    • Marked as answer by Philip Clegg Saturday, April 19, 2014 9:50 AM
    Saturday, April 19, 2014 7:46 AM
  • You are a god send... couldn't figure this out for hours, Thanks :)

    P.Clegg

    Saturday, April 19, 2014 9:50 AM