I tried the following code which is very similar to yours and it works fine:
Private Sub ListView1_DragD rop(ByVal sender As Object, ByVal e As
System.Windows. Forms.DragEvent Args) Handles ListView1.DragD rop
Dim Filename As String
For Each Filename In e.Data.GetData( DataFormats.Fil eDrop)
Dim item As New ListViewItem
item.Text = Filename
ListView1.Items .Add(item)
Next
End Sub
Private Sub ListView1_DragE nter(ByVal sender As Object, ByVal e As
System.Windows. Forms.DragEvent Args) Handles ListView1.DragE nter
If (e.Data.GetData Present(DataFor mats.FileDrop, False)) Then
e.Effect = DragDropEffects .Copy
End If
End Sub
Are you sure that you are not using threads somewhere? Is your form running
on the main thread of your application? Are you using the MTAThreadAttrib ute
anywhere? Which error is generated by your code?
Regards, Jakob.
"Giovanni pepe" wrote:
This is my code for Drag&Drop :
Lvw_DragDrop:
--------------------------------------------------------------------------
For Each Filename In e.Data.GetData( DataFormats.Fil eDrop)
ReDim Preserve SourceFiles(i)
SourceFiles(i) = CompleteFilenam e
i = i + 1
Next
--------------------------------------------------------------------------
Lvw_DragEnter:
------------------------------------------------------------------------
If (e.Data.GetData Present(DataFor mats.FileDrop, False)) Then
e.Effect = DragDropEffects .Copy
End If
------------------------------------------------------------------------
This code generate an error ...
The error is disappear when i insert into code Application.Thr eadException