473,387 Members | 1,532 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Error trying to drag and drop between app instances (of same app)


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
Nov 16 '05 #1
1 1449
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
Nov 16 '05 #2

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

Similar topics

3
by: simon_s_li | last post by:
Hi, I am having problems using drag drop and re-ordering items. Example: When I drag and item from position 1 and drag it to position 3, I want to re-order all the items accordingly. This...
2
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...
2
by: Dante | last post by:
Has anyone ever successfully gotten a web deployed exe to have Drag Drop capabilities? I'm currently getting the message: An unhandled exception of type 'System.InvalidOperationException'...
4
by: Qingdong Z. | last post by:
I have a VS.NET windows application which use drag-drop feather. It works fine when application start, but stops working after application run one or two days. The application is related to Video...
0
by: SamSpade | last post by:
There seems to be two ways to put things on the clipboard: SetClipboardData and OleSetClipboard If I want to get data off the clipboard do I care how it was put there? What about Drag/Drop;...
5
by: Brian Henry | last post by:
I haven't worked much with drag/drop but I am trying to make a form that accepts files to drug onto it from explorer and droped and have the form know the full path and file name of the files...
1
by: timnels | last post by:
I have created a muti-select treeview control. Problem is I am now trying to implement drag/drop in the application that uses it. It seems the mouse down and mouse move events fire before the...
1
by: Nick | last post by:
Hi, I am developping an app using managed C++. I want to be able to do a drag drop from the app to windows explorer. The files to be dropped onto explorer do not exist yet, the files are to be...
10
by: Webbyz | last post by:
Hello, I was wondering if there is a way that I can enable my application to accept a file such as a .pdf that when dropped onto the document, it will upload the file to my database or a directory....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.