Drag & Drop File

  • Thread starter Thread starter Mike Chan
  • Start date Start date
M

Mike Chan

Is it possible to drop a file from the VB.Net Application to the "Desktop"
or somewhere and start the copy file action? (I already know how to drop in
the application, but no idea how to drop out)
 
Hi Mike,

I never tried it, but I think just write it to the desktop, the folder
browser is included in the code but that you can delete I think.

I hope this helps?

Cor
\\\
'Copy with windows explore some files and than this
Private Sub Button1_Click(ByVal sender _
As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim folderbrowserDialog1 As New FolderBrowserDialog
Dim iData As IDataObject = Clipboard.GetDataObject()
If iData.GetDataPresent(DataFormats.FileDrop) Then
Dim clipbrd As String() = DirectCast(iData.GetData(DataFormats.FileDrop),
String())
Dim i As Integer
folderbrowserDialog1.ShowDialog()
For i = 0 To clipbrd.Length - 1
If System.IO.File.Exists(folderbrowserDialog1.SelectedPath _
& System.IO.Path.GetFileName(clipbrd(i))) Then
System.IO.File.Move(folderbrowserDialog1.SelectedPath & _
"\" & _
System.IO.Path.GetFileName(clipbrd(i)), _
folderbrowserDialog1.SelectedPath & "temptemptemp.temp")
End If
System.IO.File.Copy(clipbrd(i), folderbrowserDialog1.SelectedPath & _
"\" & _
System.IO.Path.GetFileName(clipbrd(i)))
If System.IO.File.Exists(folderbrowserDialog1.SelectedPath _
& "temptemptemp.temp") Then
System.IO.File.Delete(folderbrowserDialog1.SelectedPath & _
"temptemptemp.temp")
End If
///
 
Back
Top