Link to home
Start Free TrialLog in
Avatar of Slimshaneey
SlimshaneeyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Problem with simple file drag and drop. Help??!!

Hi there. I have a very simple form. What I want to do is allow the user to drag an image file into the small form, have the form use the shell command to create a network drive, copy the drag&drop file to the drive, and then close the created drive. Im having a few probs though running the shell command, and also gett the file I need to operate on.

The code I have is simple but close I think. Can anyone tell me what Im doing wrong?

    Private Sub frmDrop_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
        Try
            'Exception thrown here over permissions. How can I execute these commands?
            Shell("Net use n: /Delete", AppWinStyle.Hide, True)
            Shell("net use n: \\192.168.1.1\c$\inetpub\wwwroot\iCentral\banners\advision\  password /USER:administrator", AppWinStyle.Hide, True)

            If e.Data.GetDataPresent(DataFormats.FileDrop) Then
                'Perform a copy command here
'also how do I get the file handle so that I can copy it to the n drive?

            End If


        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            Shell("Net use n: /Delete", AppWinStyle.Hide, True)
        End Try
       
    End Sub

    Private Sub frmDrop_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragEnter


        e.Effect = DragDropEffects.Copy

    End Sub
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial