|
|
Title | Process files dragged onto a form |
Description | This example shows how to process files dragged onto a form in Visual Basic 6. It catches the form's OLEDragDrop event and lists the files dropped. |
Keywords | OLE, drag and drop, drop |
Categories | Controls |
|
|
Set the form's OLEDropMode to 1 - Manual. When files are dropped, the form's OLEDragDrop event fires. Examine the Data object to see what files were dropped. See the help for DataObject for more information.
Set Effect to determine how the source treats the files. For example, if Effect = vbDropEffectMove, the data is being moved so the source removes the data from itself. See the help for OLEDragDrop for more information.
|
|
Private Sub Form_OLEDragDrop(Data As DataObject, Effect As _
Long, Button As Integer, Shift As Integer, X As Single, _
Y As Single)
Dim txt As String
Dim fname As Variant
For Each fname In Data.Files
txt = txt & fname & vbCrLf
Next fname
MsgBox txt
' Indicate we did nothing with the files.
Effect = vbDropEffectNone
End Sub
|
|
|
|
|
|