Re: Drag & Drop Multiple Items between ListBoxes by VJ
VJ
Tue May 09 09:20:15 CDT 2006
This is a multi-part message in MIME format.
------=_NextPart_000_0033_01C67349.C806E620
Content-Type: text/plain;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Dennis..=20
Ok let me explain a little bit better,=20
lstSource.DoDragDrop(sender, DragDropEffects.All);
When you do the above.. your "sender" here is the object i.e Listbox, =
which will have multiple selected items.. from selectedItems property... =
, this is going to be available in the destination, which you can =
drop..., so in destination..
ListBox lstSource =3D (ListBox)(e.Data.GetData(typeof(ListBox)));
lstSource.SelectedItems; //<-- has source all selected items;
I am not sure what is not working.. can you give a piece of code =
outline.. ? or maybe be you are looking for showing the Drag of multiple =
items.. in which case you will have to have a icon or image for the =
cursor that can show this effect...
Vijay
"BVM" <DennisH@TBH.com.au> wrote in message =
news:uxVmtzxcGHA.4312@TK2MSFTNGP05.phx.gbl...
Thanks, Vijay. I have done what you said. The problem is I cannot drag =
multi-selected items. It seems DoDragDrop does not work when list items =
are multiple selected.
Dennis Huang
"Vijay" <vijay@msdiscussions.com> wrote in message =
news:eXM%235swcGHA.3344@TK2MSFTNGP05.phx.gbl...
Not very different from single item, in this case your source =
becomes a collection of items rather than just a single item...in which =
you will send all selecteditems from the listbox.. This is provided you =
have enabled multi select in the list box
Vijay
"BVM" <DennisH@TBH.com.au> wrote in message =
news:%230Qr41vcGHA.5116@TK2MSFTNGP04.phx.gbl...
Hi, All:
Do you know how to do drag & drop multiple items between =
listboxes? I can only do with single selection.
Thank you,
Dennis Huang
------=_NextPart_000_0033_01C67349.C806E620
Content-Type: text/html;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312">
<META content=3D"MSHTML 6.00.2900.2873" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Dennis.. </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Ok let me explain a little bit better,=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>lstSource.DoDragDrop(sender,=20
DragDropEffects.All);</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>When you do the above.. your "sender" =
here is the=20
object i.e Listbox, which will have multiple selected items.. from=20
selectedItems property... , this is going to be available in the =
destination,=20
which you can drop..., so in destination..</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2> ListBox lstSource =3D =
(ListBox)(e.Data.GetData(typeof(ListBox)));<BR> lstSourc=
e.SelectedItems;=20
//<-- has source all selected items;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>I am not sure what is not working.. can =
you give a=20
piece of code outline.. ? or maybe be you are looking for showing the =
Drag of=20
multiple items.. in which case you will have to have a icon or image for =
the=20
cursor that can show this effect...</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Vijay</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV>"BVM" <<A =
href=3D"mailto:DennisH@TBH.com.au">DennisH@TBH.com.au</A>>=20
wrote in message <A=20
href=3D"news:uxVmtzxcGHA.4312@TK2MSFTNGP05.phx.gbl">news:uxVmtzxcGHA.4312=
@TK2MSFTNGP05.phx.gbl</A>...</DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV><FONT face=3DArial size=3D2>Thanks, Vijay. I have done what you =
said. The=20
problem is I cannot drag multi-selected items. It seems DoDragDrop =
does not=20
work when list items are multiple selected.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Dennis Huang</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"Vijay" <<A=20
=
href=3D"mailto:vijay@msdiscussions.com">vijay@msdiscussions.com</A>> =
wrote=20
in message <A=20
=
href=3D"news:eXM%235swcGHA.3344@TK2MSFTNGP05.phx.gbl">news:eXM%235swcGHA.=
3344@TK2MSFTNGP05.phx.gbl</A>...</DIV>
<DIV><FONT face=3DArial size=3D2>Not very different from single =
item, in this=20
case your source becomes a collection of items rather than just a =
single=20
item...in which you will send all selecteditems from the listbox.. =
This is=20
provided you have enabled multi select in the list box</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Vijay</FONT></DIV>
<BLOCKQUOTE dir=3Dltr=20
style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV>"BVM" <<A=20
href=3D"mailto:DennisH@TBH.com.au">DennisH@TBH.com.au</A>> =
wrote in=20
message <A=20
=
href=3D"news:%230Qr41vcGHA.5116@TK2MSFTNGP04.phx.gbl">news:%230Qr41vcGHA.=
5116@TK2MSFTNGP04.phx.gbl</A>...</DIV>
<DIV><FONT size=3D2>Hi, All:</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Do you know how to do drag & drop multiple =
items=20
between listboxes? I can only do with single =
selection.</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Thank you,</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Dennis=20
Huang</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>
------=_NextPart_000_0033_01C67349.C806E620--