473,783 Members | 2,363 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

drag / drop list view items from two list views

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!
Mar 22 '06 #1
3 3538
The ListViewItem.Cl one 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******** ******@TK2MSFTN GP11.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!

Mar 22 '06 #2
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******** ******@TK2MSFTN GP12.phx.gbl...
The ListViewItem.Cl one 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******** ******@TK2MSFTN GP11.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!


Mar 22 '06 #3
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.Selec tedItems
Dim newItem As ListViewItem = CType(item.Clon e(), 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******** ******@TK2MSFTN GP11.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******** ******@TK2MSFTN GP12.phx.gbl...
The ListViewItem.Cl one 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******** ******@TK2MSFTN GP11.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!



Mar 23 '06 #4

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

Similar topics

4
8492
by: John Guarnieri | last post by:
Hi All, I need some code to drag items in a list box either up or down along with not just the text but with the itemdata too. Can anyone hook me up? TIA John
2
4337
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard ( I don't mean different formats): SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put there? What about Drag/Drop; is there more than one way for the source to make data available Is it always OLE?
3
10416
by: Ajay Krishnan Thampi | last post by:
I have a slight problem implementing 'drag and drop' from a datagrid to a tree-view. I have pasted my code below. Someone please advice me on what to do...pretty blur right now. ==code== using System; using System.Drawing; using System.Collections; using System.ComponentModel;
7
2501
by: Sam | last post by:
Hi, I've done the method described here : http://64.78.52.104/FAQ/WinForms/FAQ_c87c.asp#q565q It works well for items added at design time. However if my source list is filled with a datasource, the items are properly displayed but the method private void OnDragEnter(object sender,
3
10599
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
3
4770
by: JL | last post by:
I have found may examples for dragging and dropping between list boxes but I need to do it within one. Can some one point me to a tutorial or example. Prefer VB but can use C# too. TIA, John
1
1756
by: Alan T | last post by:
I have a tree view on the left and a list view on the right. I will drag and drop from list view to treeview, and also drag drop tree node on the same tree view. How do I differentiate I drag from listview or within the tree view when I drop on the tree view ?
1
5375
by: Sim | last post by:
Hello NG, I try to use drag and drop function between two list views. For this I found following code: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchimpdragdrop.asp It works fine, but I have another problem. I want to create functionality like a Windows Explorer. This means, if I select some items from list view No 1 and drag&drop this to the list view No 2, then I want to mark automatically
2
8155
by: anchi.chen | last post by:
Hi People, Just wondering if any of you have ever come across any javascript examples that will allow one to drag and drop multiple items between lists? That is, users would be able to use the "Shift" or "Ctrl" buttons to select multiple items from LIST 1 and drag them to LIST 2 in one go. I've already have the code to drag and drop between lists but for 1 item at a time. The only method to move multiple items between lists
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10081
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.