Drag and Drop From ListView to ListBox

I am using TreeView to display files in ListView  which works fine. I am trying to drag a file from the ListView to a ListBox to do things with the file but I cannot make it work. I do have Allow Drop set to True in the ListBox. Below is the code I have so far.

For the ListView
Private Sub lstDirectoryInfo_ItemDrag(sender As Object, e As ItemDragEventArgs) Handles lstDirectoryInfo.ItemDrag
        Dim lvItem As ListViewItem
        lvItem = CType(e.Item, ListViewItem)
        Dim importantData As String
        importantData = lvItem.Text
        Dim drp As DragDropEffects
        drp = lstDirectoryInfo.DoDragDrop(e.Item, DragDropEffects.Copy)
    End Sub

For The ListBox
Private Sub lstSFTP_DragDrop(sender As Object, e As DragEventArgs) Handles lstSFTP.DragDrop
        Dim str As String = CStr(e.Data.GetData(DataFormats.StringFormat))
    End Sub
    Private Sub lstSFTP_DragEnter(sender As Object, e As DragEventArgs) Handles lstSFTP.DragEnter
        If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then
            e.Effect = DragDropEffects.Copy
            e.Effect = DragDropEffects.None
        End If
    End Sub

What I want to accomplish is have the filename in the ListBox.

Thank You
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

looks like you assign drp to the dodragdrop function but you never enable the dodragdrop function for the listview
drp = lstDirectoryInfo.DoDragDrop(e.Item, DragDropEffects.Copy)
try this:
lstDirectoryInfo.DoDragDrop(e.Item, DragDropEffects.Copy)
dthillsrAuthor Commented:
That did not help. I need to mention also that when I click on an item in the listbox I get a circle with a line through it for the cursor I have enclosed a document with a print screen of that.
I think the issue is in your dragenter event. You are only allowing a drop if the item being dragged is a file which it isn't.
Learn SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

dthillsrAuthor Commented:
Would you know how I would adjust the code?
dthillsrAuthor Commented:
I have figured this out and no longer need assistance.
dthillsrAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for dthillsr's comment #a40687755

for the following reason:

I did more research on listview in order to correct the problem.
David Johnson, CD, MVPOwnerCommented:
and your solution was?  please do not enclose graphics in a word document in the future
dthillsrAuthor Commented:
This is the code I used to copy a file from my listview to listbox.

Dim lvi As ListViewItem = lstDirectoryInfo.SelectedItems(0)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.