Alex Rivera | Logout

ListView's DragEnter, DragOver, DragDrop event not raised (AllowDrop=True)

Asked 2009-02-17T14:57:26.973
11

This one is very weird:

My app works just fine, but suddenly the damn ListView control's events are not raised any more. It just comes and goes without any clear reason. (Obviously) I've set the AllowDrop property to True and handled the DragEnter, DragOver and DragDrop events as follows:

Private Sub lstApplications_DragDrop(ByVal sender As Object, ByVal e As    System.Windows.Forms.DragEventArgs) Handles lstApplications.DragDrop, Me.DragDrop
    m_fileNames = CType(e.Data.GetData(DataFormats.FileDrop), String())
    mnuType.Show(Cursor.Position, ToolStripDropDownDirection.BelowLeft)
End Sub

Private Sub lstApplications_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lstApplications.DragEnter, Me.DragEnter, lstApplications.DragOver, Me.DragOver
    If chkMode.Checked OrElse Not e.Data.GetDataPresent(DataFormats.FileDrop, True) Then
        e.Effect = DragDropEffects.None
    Else
        e.Effect = DragDropEffects.Copy
    End If
End Sub

It doesn't matter what code I wrote in these two methods because none of the events are raised. Is there anything I'm missing here?


I run the same app on another machine and it worked just fine. I then restarted my own machine and everything started working again. I'm not sure, but seems like something was wrong with Windows.

Edit
Report

1 Answer

0

Have you tried deleting the method handler stubs, recompiling, then putting them back it and compiling again? I know it sounds wacky but there have been times were I just needed to reset my working copies.

answered 2009-02-17T15:12:18.047

Your Answer