I'm writing a program that has a ListBox control. If the user drags a file and drops it on the listbox, the filename should be added to the list. I'm using the following code:
Private Sub ListBox1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
e.Effect = DragDropEffects.None
Private Sub ListBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles ListBox1.DragDrop
Stop 'This is called
Dim s$ = e.Data.GetData(DataFormats.FileDrop, True) 'Why does this exit the sub?
Stop 'This not
As you can see, I put 2 stop statements in the DragDrop event. The first of them is called and stops debugging, but then e.data.getdata somehow exits the sub, and so nothing happens.
Is it even possible that a procedure exits the sub it is called from (without exiting the thread)???
I'm very confused ; I would be grateful to anyone who could give me an explanation for this.