Advertisement
ASP_Volume3 Coding Standards #49772

simple drag drop file textbox

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

AI

สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

ซอร์สโค้ด
original-source
create a textbox on an empty form<br>
in the property window of the textbox change the OLEDropMode to "Manual".
<br>
<b>now add this function to your form code:</b>
<br>
<br>
Private Sub Text1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
<br>
<br>
 If Data.GetFormat(vbCFFiles) Then Text1.Text = Data.Files(1)
<br>
<br>
End Sub
<br>
<b>add the following if you don't want to show the drag drop mouse pointer when the item is not a file </b>
<br>
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)<br><br>
 If Not Data.GetFormat(vbCFFiles) Then Effect = vbDropEffectNone
<br>
<br>
End Sub
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine