472,799 Members | 1,594 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Drag & Drop - Passing Objects Between Processes

Hi

Can anyone give me any help with passing an object across processes, via drag and

drop?

I've written a custom ListView control, which supports dragging and dropping of

its items. The drag and drop works fine within the same application, but fails

when dragging between two instances of the app.

I'm using my own collection class, called Series (derived from CollectionBase),

which holds simple objects representing the list items that are being dragged.

When the drag operation starts, I call DoDragDrop and supply a new instance of a

Series collection as the data.

In the DragDrop event, I retreive the data back from the arguments using GetData.

When dragging within the same application, I receive an object which can be

casted to a Series object, and all is well.

However, when dragging between two application instances, I receive an object

that appears to be a "System.__ComObject" - which I'm not able to cast back to a

Series object.

I've read several newsgroup postings around this area, and most seem to suggest

implementing the ISerializable interface on the object being passed. I've tried

this in the Series class - but it didn't seem to make any difference to the

behaviour I was seeing.

I'd really appreciate any help or hints with this - I've been stumped for days!

Thanks in advance,

Barry Moon
Nov 16 '05 #1
2 4404
Barry,

Did you implement the serialization correctly? You have to add the
Serializable attribute, and if you are implementing ISerializable for custom
serialization, you have to provide a special constructor.

Can you post some of your code?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Barry Moon" <ba********@mailinator.com> wrote in message
news:49**************************@posting.google.c om...
Hi

Can anyone give me any help with passing an object across processes, via
drag and

drop?

I've written a custom ListView control, which supports dragging and
dropping of

its items. The drag and drop works fine within the same application, but
fails

when dragging between two instances of the app.

I'm using my own collection class, called Series (derived from
CollectionBase),

which holds simple objects representing the list items that are being
dragged.

When the drag operation starts, I call DoDragDrop and supply a new
instance of a

Series collection as the data.

In the DragDrop event, I retreive the data back from the arguments using
GetData.

When dragging within the same application, I receive an object which can
be

casted to a Series object, and all is well.

However, when dragging between two application instances, I receive an
object

that appears to be a "System.__ComObject" - which I'm not able to cast
back to a

Series object.

I've read several newsgroup postings around this area, and most seem to
suggest

implementing the ISerializable interface on the object being passed. I've
tried

this in the Series class - but it didn't seem to make any difference to
the

behaviour I was seeing.

I'd really appreciate any help or hints with this - I've been stumped for
days!

Thanks in advance,

Barry Moon

Nov 16 '05 #2
Nicholas

Well, I have to admit that my implementation of ISerializable just
provides empty methods at the moment. I assumed that as long as my
code created a Series object, even though it was empty, that would
prove that the casting worked. Once I'd got the cast working I
intended to add the full implementation afterwards. Perhaps this was a
mistake...?

Here's the serialization code for my Series class:
public class Series : System.Collections.CollectionBase,
ISerializable
{
...

/// <summary>
/// Default constructor.
/// </summary>
public Series() : base()
{
}

/// <summary>
/// DeSerialization constructor.
/// </summary>
/// <param name="info">Stores data required for
deserializing.</param>
/// <param name="ctxt">Serialization details.</param>
public Series(SerializationInfo info, StreamingContext ctxt) :
base()
{
//Get the values from info and assign them to the appropriate
properties
}

...

/// <summary>
/// Serialization function.
/// </summary>
/// <param name="info">Stores data required for
deserializing.</param>
/// <param name="ctxt">Serialization details.</param>
public void GetObjectData(SerializationInfo info, StreamingContext
ctxt)
{
//Describe this object to the info here...
}

...

}

I appreciate your help.

Thanks,
Barry

(P.S. - Sorry about the nasty double-spacing in my original message!)
Nov 16 '05 #3

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

Similar topics

1
by: Karsten Schramm | last post by:
Hi, if I drag an Outlook.MailItem to a Windows-Explorer window a <subject>.msg file will be created. Now I try to drag & drop a mail item to my own WinForm app. Unfortunately it doesn't work....
3
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== ...
6
by: jojobar | last post by:
Hello, I look at the asp.net 2.0 web parts tutorial on the asp.net web site. I tried to run it under firefox browser but it did not run. If I want to use this feature in a commercial product...
3
by: Goldwind | last post by:
Hi, I"m trying to use drag & drop of text from one text box to another but without suceess. Microsoft presented an example in "101 code samples" BUT in this example the code select and drag all...
2
by: misower | last post by:
var c = document.getElementById("PanelTree"); // PanelTree is a <div> element! var n = document.createElement("div"); n.setAttribute('id', 'nu'); n.setAttribute('style',...
0
by: haegens | last post by:
I am making a .NET Application which has a TreeView Control in it. I have 3 levels of nodes. The toplevel is a rootnode which contains all other nodes. The second level holds one kind of nodes that...
1
by: SteveDouglas | last post by:
Hi all, I am currently writing an application in VB.NET that has a lot of controls (treeviews/listviews/labels and so forth) that represent "things" that need to be draggable from place to place,...
3
by: Hartmut Dippon | last post by:
Hi all, I hope somebody can help me with following problem: I have an application where I can drag&drop files/dirs from within explorer onto my form. If multiple files/dirs are selected I...
2
by: deccio | last post by:
I have create an activex Control with Visual studio 2005 and framework 2.0 in c# to add drag & drop functionality to upload multi file. When I use it in a windows form it work fine. Infact if I...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.