|
-
Nov 2nd, 2000, 11:36 AM
#1
Thread Starter
Fanatic Member
Hi All
How do I drag a file onto a text box and display the files path and name in the text box.
Cheers
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Nov 2nd, 2000, 03:29 PM
#2
Set the OLEDropMode property of the TextBox to 1 Manual, then use this:
Code:
Private Sub Text1_OLEDragDrop(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim varFiles As Variant
On Error Resume Next
For Each varFiles In Data.Files
Text1.Text = Text1.Text & varFiles & vbCrLf
Next
End Sub
This will allow you to drag multiple files as well.
-
Nov 3rd, 2000, 03:54 AM
#3
Thread Starter
Fanatic Member
Thanks Serge
That works fine but leaves two characters at the end
Code:
C:\WINNT\Profiles\loweg\Desktop\test.lf
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Nov 3rd, 2000, 03:56 AM
#4
Thread Starter
Fanatic Member
Serge
It doesn't disply them on the previous post but it leaves two bold lines on the end.
Do you know anyway to stop this?
Thanks
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

-
Nov 3rd, 2000, 04:55 AM
#5
Lively Member
Set the OLEDropMode to Manual and the MultiLine property on the text box to TRUE, and try this....
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.Files.Count > 0 Then
For z = 1 To Data.Files.Count
Text1.Text = Text1.Text + Data.Files(z) + vbNewLine
Next z
End If
End Sub
-
Nov 3rd, 2000, 05:03 AM
#6
Thread Starter
Fanatic Member
Thanks joefoulkes
works fine now
Gary Lowe 
VB6 (Enterprise) SP5
ADO 2.6
SQL Server 7 SP3
OK I know my spelling and grammer is crap so don't quote me on it!
To err is human to take the P! is only natural !!
Click on the top section of image for Marcus Miller website and bottom section of image for 'Run For Cover' sound clip

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|