VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



simple drag drop file textbox

by cold_postage (1 Submission)
Category: Coding Standards
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

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

Rate simple drag drop file textbox

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

Download this snippet    Add to My Saved Code

simple drag drop file textbox Comments

No comments have been posted about simple drag drop file textbox. Why not be the first to post a comment about simple drag drop file textbox.

Post your comment

Subject:
Message:
0/1000 characters