TreeView drag-n-drop between applications

K

Kevin Henkener

I would like to be able to drag-n-drop System.Windows.Forms.TreeNode
objects between two different applications (actually the same
application, just two instances of it) in C#. I've seen posts in
which people advise that this process is no different the
intra-application drag-n-drop process. I've had no luck with this
concept. In fact, when I drag a node from application A's TreeView to
application B's TreeView and call the GetData method on the Data
object from the DragEventArgs, the result is some kind of
System.Runtime.Remoting.Proxy.__TransparentProxy. There is no
TreeNode information available. I'm absolutely stumped at the moment
and would appreciate any help.

Thanks.
 
D

Dmitriy Lapshin [C# / .NET MVP]

Kevin,

This is most likely because the TreeNode class is not marked as serializable
and is therefore marshalled between application domains by reference. I
would suggest creating a simple serializable type describing the data in the
node and use an instance of this type as the data object for the drag and
drop operation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top