Eduards
Eduards

Reputation: 68

VB.NET programmatically do drag-and-drop from my local file system to a 3rd party application via my own user form

I am kind of lost trying to figure out the way how to drag and drop a file using a form.

Say I have my own files explorer app made in VB.NET and what I am looking for is that when I click on a Picturebox_Icon and drag it to another app (in my case SOLIDWORKS) that it drags and drops the file into SOLDIWORKS like it would if I just dragged and dropped the file from windows file explorer.

what I got so far:

    Sub DynamicButton_StartDrag(ByVal sender As PictureBox, ByVal e As System.Windows.Forms.MouseEventArgs)

        'Set variables
        strFilename = Split(sender.Name, "_")(2)
        strFilenameWithoutExtension = IO.Path.GetFileNameWithoutExtension(strFilename)
        strFullPath = Directory_PartsAndAssembliesLibrary & strComponentsCategory & "\" & strFilename

        Process.Start("explorer.exe", "/select," & strFullPath)

    End Sub

    Sub DynamicButton_whileDragging(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs)

    End Sub

    Sub DynamicButton_EndDrag(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub

My picturebox_icon which I make programmatically has the filename in it's name and that's what I extract upon a mousedown event DynamicButton_StartDrag and then I get the full path to the file as strFullPath

Could someone at least, please, guide me to teh right approach to this problem. Practicall aplication to this is that I have a handy SOLDIWORKS files explorer form for thousands of files which makes it way easier to find what user is looking for than the windows file explorer. So Now I need to be able to drag and drop the files via the form.

Upvotes: 0

Views: 245

Answers (0)

Related Questions