Slimshaneey
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.DragE ventArgs) 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\w wwroot\iCe ntral\bann ers\advisi on\ password /USER:administrator", AppWinStyle.Hide, True)
If e.Data.GetDataPresent(Data Formats.Fi leDrop) 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.DragE ventArgs) Handles Me.DragEnter
e.Effect = DragDropEffects.Copy
End Sub
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.DragE
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\w
If e.Data.GetDataPresent(Data
'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.DragE
e.Effect = DragDropEffects.Copy
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.