Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
TitleProcess files dragged onto a form
DescriptionThis 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.
KeywordsOLE, drag and drop, drop
CategoriesControls
 
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
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated