joekendall
asked on
How To Retrieve Data From Drag/Drop Of An Office Object
I am using VB.NET 2008 to develop a windows form application. I would like to know how to capture an object such as a Report that is in Microsoft Access 2003 that is being dragged and dropped. When you drag and drop a Report from Microsoft Access to the Desktop, it creates a link. How do I capture the Report that is going to be dropped and put the link it will create into a ListView in my VB.NET form?
Thanks for your help in advance!
Joe
Thanks for your help in advance!
Joe
ASKER
I appreciate the links, but I have seen the same thing in other places. They just don't work for what I am doing. Here is my code in the DragDrop event of the ListView. It works fine if I have already made a link on the desktop and drag it over the ListView. It doesn't work though if I try to drag from Access over the ListView. Any help along those lines is appreciated. I thought there might be a way in the .NET framework without using an API. If I need to use an API, that will be fine as long as someone has some code I can use as a reference.
Private Sub lvObjects_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragE ventArgs) Handles lvObjects.DragDrop
If e.Data.GetDataPresent(Data Formats.Fi leDrop) Then
Dim MyFiles() As String
Dim i As Integer
' Assign the files to an array.
MyFiles = e.Data.GetData(DataFormats .FileDrop)
' Loop through the array and add the files to the list.
For i = 0 To MyFiles.Length - 1
lvResults.Items.Add(MyFile s(i))
Next
End If
End Sub
Thanks!
Joe
Private Sub lvObjects_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragE
If e.Data.GetDataPresent(Data
Dim MyFiles() As String
Dim i As Integer
' Assign the files to an array.
MyFiles = e.Data.GetData(DataFormats
' Loop through the array and add the files to the list.
For i = 0 To MyFiles.Length - 1
lvResults.Items.Add(MyFile
Next
End If
End Sub
Thanks!
Joe
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
the following URL has some inner link on the left side follow that also
http://www.developerfusion.co.uk/show/2692/
and also visit this
http://www.geekpedia.com/tutorial108_Using-drag-and-drop-operations.html
http://www.c-sharpcorner.com/UploadFile/mgold/DoingDragandDropUsingCSharp11302005020610AM/DoingDragandDropUsingCSharp.aspx