G
Glen
I am using two listboxes on a windows form. The objects listed in the
first listbox (A) can be dragged and dropped into the second listbox
(B).
This works great and was quite easy. Of course, as part of that
process, I intercept the mousedown event for listbox-A to begin the
drag/drop operation.
However, I ALSO want to be able to detect the double-click selection of
an item in listbox-A so that I can pop up a new form with details about
that item.
The problem seems to be that the mousedown event "short circuits" the
double click event for that listbox (A).
(Code Below)
What am I doing wrong? Any suggestions would be greatly appreciated.
Sincerely,
Glen Wolinsky
--------------------------
Numbers 6:24-26
--------------------------
#Region "Associates Mouse_Down"
Private Sub lbxAssociates_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles lbxAssociates.MouseDown
If e.Button = MouseButtons.Left Then _
lbxAssociates.DoDragDrop(lbxAssociates.SelectedValue.ToString,
DragDropEffects.Copy)
End Sub
#End Region
#Region "Assignments Drag Enter"
Private Sub lbxAssignments_DragEnter(ByVal sender As Object,
ByVal e As System.Windows.Forms.DragEventArgs) Handles
lbxAssignments.DragEnter
If (e.Data.GetDataPresent(DataFormats.Text)) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
#End Region
#Region "Assignments Drop"
Private Sub lbxAssignments_DragDrop(ByVal sender As Object,
ByVal e As System.Windows.Forms.DragEventArgs) Handles
lbxAssignments.DragDrop
'Do some processing
end sub
#End Region
first listbox (A) can be dragged and dropped into the second listbox
(B).
This works great and was quite easy. Of course, as part of that
process, I intercept the mousedown event for listbox-A to begin the
drag/drop operation.
However, I ALSO want to be able to detect the double-click selection of
an item in listbox-A so that I can pop up a new form with details about
that item.
The problem seems to be that the mousedown event "short circuits" the
double click event for that listbox (A).
(Code Below)
What am I doing wrong? Any suggestions would be greatly appreciated.
Sincerely,
Glen Wolinsky
--------------------------
Numbers 6:24-26
--------------------------
#Region "Associates Mouse_Down"
Private Sub lbxAssociates_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles lbxAssociates.MouseDown
If e.Button = MouseButtons.Left Then _
lbxAssociates.DoDragDrop(lbxAssociates.SelectedValue.ToString,
DragDropEffects.Copy)
End Sub
#End Region
#Region "Assignments Drag Enter"
Private Sub lbxAssignments_DragEnter(ByVal sender As Object,
ByVal e As System.Windows.Forms.DragEventArgs) Handles
lbxAssignments.DragEnter
If (e.Data.GetDataPresent(DataFormats.Text)) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub
#End Region
#Region "Assignments Drop"
Private Sub lbxAssignments_DragDrop(ByVal sender As Object,
ByVal e As System.Windows.Forms.DragEventArgs) Handles
lbxAssignments.DragDrop
'Do some processing
end sub
#End Region