think this was simply due to the fact that I was debugging one app instance, run both instances outside the IDE and works as expected!
"Derrick" <de*********@excite.com> wrote in message news:uk**************@TK2MSFTNGP14.phx.gbl...
I have a basic C# windows forms app where drag and drop of a simple class, no gui, from one tree to another (I store the class instance in the "tag" field of the tree nodes, and drag that) That is working fine within the same app instance. If I start two instances of the same app and try to drag from one app instance to the other, I get the below exception:
A first chance exception of type 'System.Runtime.Serialization.SerializationExcepti on' occurred in system.windows.forms.dll
Additional information: The type System.Windows.Forms.DataObject in Assembly System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 is not marked as serializable.
What I don't understand is that I am calling DoDragDrop on the tree view, but the object I am telling it to dnd is not windows forms derived, and it contains no windows forms reference.
treeView1.SelectedNode = (TreeNode)e.Item;
MyObject objToDrag = (MyObject)((TreeNode)e.Item).Tag;
treeView1.DoDragDrop(objToDrag,DragDropEffects.Cop y|DragDropEffects.Move);
In the above example, MyObject is marked as Serializable, and I can successfully pass instances of it across a Web Service boundry.
Guessing this has something to do with the TreeView itself?
Thanks in advance!
Derrick