README.md
December 5, 2022 ยท View on GitHub
Description
drag and drop files into a textbox is simple with this code
More Info
| Submitted On | |
| By | cold_postage |
| Level | Beginner |
| User Rating | 4.5 (18 globes from 4 users) |
| Compatibility | VB 6.0, VB Script |
| Category | Coding Standards |
| World | Visual Basic |
| Archive File |
Source 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