Problem with multi-selection using shift key in listbox

G

Guest

Hi,

I'm attempting to do a drag and drop operation from one listbox to another.
I have my listboxes setup with SelectionMode = MultiExtended so that I can
use the shift key, cntrl key, etc. to make multiple selections.

The problem I am having is that when I use the shift key to select a range
of items, I first click on one item (item gets highlighted), then, holding
down the shift key, I select another item (the range of items gets
highlighted). It appears to select the range as desired, however, when I
click on the 2nd item and keep the left mouse button down and start dragging,
the listbox SelectedItems collection only has the 2nd item as being selected
and not the entire range. When I drop into the other listbox, only the 2nd
item is actually moved, because that is the only one in the selected items
collection.

I don't understand why the entire range of items (that do get highlighted)
are not in the SelectedItems collection. I would imagine this is a bug in
..NET. However, in the mean time, does anybody know how to work around this
problem?
 
G

Guest

That helped as I found this statement in that article:

"You might wonder why this example uses ListView controls rather than
ListBox controls. There is a good reason: The ListBox control does not
support dragging multiple items. Clicking the list invalidates the multiple
selection."

So, I will try to use a ListView instead of a ListBox and see what happens.
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top