Tools Links Login

simple drag drop file textbox

drag and drop files into a textbox is simple with this code

Original Author: cold_postage

Code

create a textbox on an empty form

in the property window of the textbox change the OLEDropMode to "Manual".


now add this function to your form code:




Private Sub Text1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)




If Data.GetFormat(vbCFFiles) Then Text1.Text = Data.Files(1)




End Sub


add the following if you don't want to show the drag drop mouse pointer when the item is not a file


Private Sub Text1_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)


If Not Data.GetFormat(vbCFFiles) Then Effect = vbDropEffectNone




End Sub

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 88 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.