Click here to Skip to main content
11,410,118 members (63,048 online)
Rate this: bad
good
Please Sign up or sign in to vote.
Hi !
i want to move a zip with drag and drop to the specified folder like this


   Private Sub Panel1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Panel1.DragEnter
        If File drop Then
            Dim path As String = "D:/pictures"
            Move file to path
        Else
        End If
    End Sub

when i drag file to panel1 and drop it the file move automatcly to folder D:/pictures
How i can make this code ?
TNX for help !
Posted 24-Nov-11 4:33am
Edited 24-Nov-11 4:44am
v2
Comments
LanFanNinja at 24-Nov-11 10:19am
   
Check my solution
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Something like this should work
Note: I used the Form in this example but will be the same for a Panel just make sure the AllowDrop property of you Panel is set to true.
Private Sub Form1_DragEnter(sender As Object, e As DragEventArgs) Handles MyBase.DragEnter
    If e.Data.GetDataPresent(DataFormats.FileDrop) Then
        e.Effect = DragDropEffects.Move
    End If
End Sub
 
Private Sub Form1_DragDrop(sender As Object, e As DragEventArgs) Handles MyBase.DragDrop
    Dim fileList As String() = DirectCast(e.Data.GetData(DataFormats.FileDrop, False), String())
    For i As Integer = 0 To fileList.Length - 1
        Dim destPath As String = "D:/pictures/"
        Directory.Move(fileList(i), destPath & Path.GetFileName(fileList(i)))
        'if only files and never directories and files you can use this instead
        'File.Move(fileList(i), destPath & Path.GetFileName(fileList(i)))
    Next
End Sub
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 229
1 OriginalGriff 140
2 Maciej Los 138
3 Sascha Lefévre 120
4 BillWoodruff 60
0 Sergey Alexandrovich Kryukov 8,771
1 OriginalGriff 6,905
2 Maciej Los 3,390
3 Abhinav S 3,248
4 Peter Leow 3,059


Advertise | Privacy | Mobile
Web02 | 2.8.150414.5 | Last Updated 24 Nov 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100