locked
Drag and Drop from Media Device RRS feed

  • Question

  • Hello.. I have added drag and drop from windows explorer to a picturebox on my form. When doing this from the C Drive it works fine.. however, when I try and drag and drop from a media device, it does not work?

    this is the code I have on the dragdrop

            Dim files() As String = e.Data.GetData(DataFormats.FileDrop)
            For Each path In files
                'MsgBox(path)
                Me.txtFileName.Text = path
                btnUpload_Click(sender, e)
                Refresh()
    next

    • Edited by LandLord324 Friday, February 26, 2016 7:15 PM added code
    Friday, February 26, 2016 6:58 PM

Answers

All replies

  • however, when I try and drag and drop from a media device, it does not work?

    What do you mean 'does not work'?  Is there an error, or does it do something other than what you expected?  What did you expect, and what does it do?

    You should write a small debugging routine to insert at that point and list the data on the clipboard, so you know what is being dragged.  For an example, see:

    https://msdn.microsoft.com/en-us/library/0tb2e1ah(v=vs.110).aspx

    or use a utility such as http://www.freeclipboardviewer.com/windowsclipboard.html

    Friday, February 26, 2016 8:37 PM
  • ok.. I'll try that... I don't get any errors.. with the exception that the mouse cursor goes to a the circle with the line through it.

    Friday, February 26, 2016 8:40 PM
  • ... with the exception that the mouse cursor goes to a the circle with the line through it.

    That implies that the code in the DragEnter event handler is not correctly identifying the clipboard content, and that in turn implies that the content isn't a file.
    Saturday, February 27, 2016 9:57 PM