Hi everybody,
Following is the code of the MouseDown event of a list box:
Code:
Private Sub ListBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDown
Dim DragDropResult As DragDropEffects
If e.Button = MouseButtons.Left Then
DragDropResult = ListBox1.DoDragDrop(ListBox1.Items(ListBox1.SelectedIndex), _
DragDropEffects.Move Or DragDropEffects.Copy)
' If operation is a move (and not a copy) then
' remove the item from the first list box.
If DragDropResult = DragDropEffects.Move Then
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
End If
End If
End Sub
In the above code, the code within the condition "If DragDropResult = DragDropEffects.Move Then" executes after the mouse button is released, however at that time the rest of the code does not execute. This is the first time I am observing this type of behaviour. How does this happen? Could you explain? Another thing I noticed is that the MouseUp event does not execute. When does it fire?