Drag Files From Windows To A Form, And Get Their Full Path

If you will drag c:\autoexec.bat and c:\setup.ini to your form, on the form will be printed:
c:\autoexec.bat
c:\setup.ini

You can do the same with other control, for example, let the user drag files to picture box, list box and so on.

Preparations

Set the Form OLEDropMode Property to 1 - manual

Form Code

Private Sub Form_OLEDragDrop(Data As DataObject, Effect As Long , _
Button As Integer, Shift As Integer, X As Single, Y As Single )
For i = 1 To Data.Files.Count
    Print Data.Files(i)
Next i
End Sub

Go Back