473,320 Members | 2,027 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem with multi-selection using shift key in listbox

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?

Nov 16 '05 #1
2 5708
It should be possible...

If you look at this MSDN article, the last section is how to do this. It's
in VB, but should be straight forward to convert.

http://msdn.microsoft.com/library/de...mpDragDrop.asp
"Matt Sawyer" <Ma********@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
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?

Nov 16 '05 #2
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!

"Dan Bass" wrote:
It should be possible...

If you look at this MSDN article, the last section is how to do this. It's
in VB, but should be straight forward to convert.

http://msdn.microsoft.com/library/de...mpDragDrop.asp
"Matt Sawyer" <Ma********@discussions.microsoft.com> wrote in message
news:9F**********************************@microsof t.com...
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?


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Chung Jiho | last post by:
Hello, We have been deploying our web application over win2k servers. It is written in Python and uses Active Scripting to meet our requirements that it must be ASP application. So far, it was...
1
by: WU FUHENG | last post by:
Today,I found a strange problem in python multi-thread programming.When I used function win32com.client.Dispatch('ADODB.Connection') in primary thread, it was OK. But when I called it in...
12
by: * ProteanThread * | last post by:
but depends upon the clique: ...
8
by: Benek | last post by:
Hello I writing dll and application in C++, and I have a following problem: In dll I have function: void get_list(BYTE *&Buffer) { BYTE* Buf = new BYTE; for(int i = 0; i < 5; ++i) { Buffer =...
3
by: Trevor Hughes | last post by:
Hello All I have a database (Access 2000, running on Win 2000), which suffers from bloat over a period of time. In order to solve the problem I set the option to compact on exit. This however...
3
by: dice | last post by:
Hi, In order to use an external api call that requires a function pointer I am currently creating static wrappers to call my objects functions. I want to re-jig this so I only need 1 static...
19
by: 叮叮当当 | last post by:
hi, all when a email body consist with multipart/alternative, i must know when the boundary ends to parse it, but the email lib have not provide some function to indicate the boundary end,...
5
by: maggie.nguyen | last post by:
Hi, I use Visual Studios 2005. In my project file, I include the library in linker: "Additional Library Directories: ..\..\boost\lib" I have these libs in the boost\lib directory: ...
1
by: mknoll217 | last post by:
I am recieving this error from my code: The multi-part identifier "PAR.UniqueID" could not be bound. The multi-part identifier "Salary.UniqueID" could not be bound. The multi-part identifier...
3
by: hhendrickx | last post by:
Hello, I have a problem showing a multi-line client-side messagebox. Single-line works ok but multi-line does not. How can I show multi-line client-side messageboxes? Code: String message =...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shllpp 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.