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
"Brian Henry" <no****@nospam.com> wrote in message
news:ee**************@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" <cl*************@nospam.nospam> wrote in message
news:ed**************@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" <no****@nospam.com> wrote in message
news:eN**************@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!