|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
drag / drop list view items from two list viewsSo what is the easiest way to do this? I have one list view with a list of
items (in detail view and with about 20 sub items) and a second list view that will take the items they drag from the first one to the second one. I tried this once a few years ago by trying to clone the list view item so i didnt have to recreate it, but ran into the problem of the item already had a parent... i dont want to remove the items from the first list when they are dragged... what is the easiest way to "clone" a list view item from one list to another? or do i have to manually create a new list view item on drop to add to the new list and manually reset all those subitems... which is tedious... thanks! The ListViewItem.Clone method works just fine in both 2003 and 2005. It
doesn't copy the parent/owner /claes Show quoteHide quote "Brian Henry" <nospam@nospam.com> wrote in message news:eNaPNUcTGHA.4264@TK2MSFTNGP11.phx.gbl... > So what is the easiest way to do this? I have one list view with a list of > items (in detail view and with about 20 sub items) and a second list view > that will take the items they drag from the first one to the second one. > I tried this once a few years ago by trying to clone the list view item so > i didnt have to recreate it, but ran into the problem of the item already > had a parent... i dont want to remove the items from the first list when > they are dragged... what is the easiest way to "clone" a list view item > from one list to another? or do i have to manually create a new list view > item on drop to add to the new list and manually reset all those > subitems... which is tedious... thanks! > wierd... it says that for me... throws an exception and says the item
already blongs to another parent... this is in VS 2005... had the same thing happen in a different program in VS.NET 2003 Show quoteHide quote "Claes Bergefall" <claes.bergefall@nospam.nospam> wrote in message news:eddI3gdTGHA.4452@TK2MSFTNGP12.phx.gbl... > The ListViewItem.Clone method works just fine in both 2003 and 2005. It > doesn't copy the parent/owner > > /claes > > "Brian Henry" <nospam@nospam.com> wrote in message > news:eNaPNUcTGHA.4264@TK2MSFTNGP11.phx.gbl... >> So what is the easiest way to do this? I have one list view with a list >> of items (in detail view and with about 20 sub items) and a second list >> view that will take the items they drag from the first one to the second >> one. I tried this once a few years ago by trying to clone the list view >> item so i didnt have to recreate it, but ran into the problem of the item >> already had a parent... i dont want to remove the items from the first >> list when they are dragged... what is the easiest way to "clone" a list >> view item from one list to another? or do i have to manually create a new >> list view item on drop to add to the new list and manually reset all >> those subitems... which is tedious... thanks! >> > > That is strange indeed. I used the following code to test the behaviour of
Clone and it works perfectly For Each item As ListViewItem In ListView1.SelectedItems Dim newItem As ListViewItem = CType(item.Clone(), ListViewItem) ListView2.Items.Add(newItem) Next This is invoked from a button click event handler /claes Show quoteHide quote "Brian Henry" <nospam@nospam.com> wrote in message news:eerB07dTGHA.4264@TK2MSFTNGP11.phx.gbl... > wierd... it says that for me... throws an exception and says the item > already blongs to another parent... this is in VS 2005... had the same > thing happen in a different program in VS.NET 2003 > > > "Claes Bergefall" <claes.bergefall@nospam.nospam> wrote in message > news:eddI3gdTGHA.4452@TK2MSFTNGP12.phx.gbl... >> The ListViewItem.Clone method works just fine in both 2003 and 2005. It >> doesn't copy the parent/owner >> >> /claes >> >> "Brian Henry" <nospam@nospam.com> wrote in message >> news:eNaPNUcTGHA.4264@TK2MSFTNGP11.phx.gbl... >>> So what is the easiest way to do this? I have one list view with a list >>> of items (in detail view and with about 20 sub items) and a second list >>> view that will take the items they drag from the first one to the second >>> one. I tried this once a few years ago by trying to clone the list view >>> item so i didnt have to recreate it, but ran into the problem of the >>> item already had a parent... i dont want to remove the items from the >>> first list when they are dragged... what is the easiest way to "clone" a >>> list view item from one list to another? or do i have to manually create >>> a new list view item on drop to add to the new list and manually reset >>> all those subitems... which is tedious... thanks! >>> >> >> > >
Decimal/Single/...: which Numeric-type to use?
How to update data in Windows Datagrid ot: mvps, how do you propse one? AddressOf from VB6 to .Net VB How to pass an object between forms. MouseUp event fires randomly on Listview How to pass an object between forms. Check for new versions Moving/deleting the DB upon close Create a new dataset from a dataview |
|||||||||||||||||||||||