Question How do I Drag-Drop multi-selected values from a listbox?

Doug

Active member
Joined
Oct 5, 2011
Messages
44
Programming Experience
Beginner
I have a form with a datagridview and a listbox on it. I want to be able to select multiple items from the listbox and drag-drop them onto a row on the DGV.

I have been able to do it fine with a single string usig the mouse_down event on the listbox. It does not work with a multiple selection since the mouse_down event happens before the item is actually selected.

Also, if I hold the mouse down and try to drag, the from stays in a selection routine and ignores the mouse_leave event.


Is what I am trying to do even possible?
 
I changed to a ListView control instead of using a ListBox. The ListView has a ItemDrag event that triggers as soon as a drag is started. It works perfectly for my purposes. ListBox does not have that event.
 
You could have made it work with a ListBox. Just because the MouseDown event occurs before the item is selected does not mean that you couldn't work out what item(s) would be selected once the selection is processed.
 

Latest posts

Back
Top