467,161 Members | 970 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,161 developers. It's quick & easy.

Drag&Drop between 2 different .NET Programs

Hi

There are 2 different .NET Programs A und B.
I'll drag a TreeNode from a TreeView in A into a ListView in B.
In B I'll extract values from the dropped TreeNode.
Unfortunately I don't know how to extract the values. :-(

Code in B
--------------
private void ListView_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)
{
:
:

:
if( e.Data.GetDataPresent( "Blabla.Node" ) ) // Blabla.Node is a
TreeNode derived Class
{
TreeNode DraggedNode =(TreeNode) e.Data.GetData( "Blabla.Node" );
// Up to above line works the drop. Debugging this code, DraggedNode
// contains the value
'System.Runtime.Remoting.Proxies.__TransparentProx y'
// I don't no how I should work with Proxies. :-(
// How can I extract the values in DraggedNode?
:
:
}
}

TIA
p

Nov 15 '05 #1
  • viewed: 2395
Share:
4 Replies
Peter,

You shouldn't have to do anything special. If the line with the cast
works and the DraggedNode is populated, then you should be able to access
the properties just like anything else.

However, you might want to consider using some other kind of data
container besides a tree node, as the tree node is part of a visul
component, and transporting those kinds of things across app-domains can
have a bad effect.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Peter Wagner" <Ci****@bigfoot.com> wrote in message
news:Oz*************@tk2msftngp13.phx.gbl...
Hi

There are 2 different .NET Programs A und B.
I'll drag a TreeNode from a TreeView in A into a ListView in B.
In B I'll extract values from the dropped TreeNode.
Unfortunately I don't know how to extract the values. :-(

Code in B
--------------
private void ListView_DragDrop(object sender,
System.Windows.Forms.DragEventArgs e)
{
:
:

:
if( e.Data.GetDataPresent( "Blabla.Node" ) ) // Blabla.Node is a
TreeNode derived Class
{
TreeNode DraggedNode =(TreeNode) e.Data.GetData( "Blabla.Node" );
// Up to above line works the drop. Debugging this code, DraggedNode // contains the value
'System.Runtime.Remoting.Proxies.__TransparentProx y'
// I don't no how I should work with Proxies. :-(
// How can I extract the values in DraggedNode?
:
:
}
}

TIA
p

Nov 15 '05 #2
Nicholas Paldino [.NET/C# MVP] wrote:
Peter,
Nicholas,

Thank you for your quick answer.

You shouldn't have to do anything special. If the line with the
cast works and the DraggedNode is populated,
'Works' was not the whole truth.
I should say, the Debugger doesn't jump out till this line.
The Debugger shows for DraggedNode in the QuickWatch dialog:
DraggedNode {System.Runtime.Remoting.Proxies.__TransparentProx y}
+[System.Runtime.Remoting.Proxies.__TransparentProxy]
{System.Runtime.Remoting.Proxies.__TransparentProx y}
+System.MarshalByRefObject
{System.Runtime.Remoting.Proxies.__TransparentProx y}
-__identity
-[System.Runtime.Remoting.Proxies.RemotingProxy]
{System.Runtime.Remoting.Proxies.RemotingProxy}
:
:
:
:
TypeName "System.Windows.Forms.TreeNode"
BackColor <error: cannot evaluate field of a proxy object>
: "
: "
(List of properties)
: "
: "
: "
TreeView <error: cannot evaluate field of a proxy object>

then you should be able
to access the properties just like anything else.
Unfortunately not.
Look the above-mentioned values. :-(

However, you might want to consider using some other kind of data
container besides a tree node,
But _it's_ a TreeNode.
as the tree node is part of a visul
component, and transporting those kinds of things across app-domains
can have a bad effect.
But TreeNode is derived from MarshalByRefObject.
The help says 'MarshalByRefObject is the base class for objects that
communicate across application domain boundaries by exchanging messages
using a proxy.'

There's no solution using Remoting, Proxies?

Hope this helps.


Yes and no.
It seems drag-dropping TreeNodes is impossible an so there's no solution.
:-(

p

Nov 15 '05 #3
Peter,

Using remoting/proxies in this case is overkill, as it seems you just
want to drop a snippet of data into another application. This snippet
doesn't have any affinity to the app-domain it came from (like a window
handle, or something of that nature), so you should make it a serializable
instance and then transport that across to your other program. It is the
MarshalByRefObject base class that is causing the problem.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Peter Wagner" <Ci****@bigfoot.com> wrote in message
news:eC****************@tk2msftngp13.phx.gbl...
Nicholas Paldino [.NET/C# MVP] wrote:
Peter,
Nicholas,

Thank you for your quick answer.

You shouldn't have to do anything special. If the line with the
cast works and the DraggedNode is populated,


'Works' was not the whole truth.
I should say, the Debugger doesn't jump out till this line.
The Debugger shows for DraggedNode in the QuickWatch dialog:
DraggedNode

{System.Runtime.Remoting.Proxies.__TransparentProx y} +[System.Runtime.Remoting.Proxies.__TransparentProxy]
{System.Runtime.Remoting.Proxies.__TransparentProx y}
+System.MarshalByRefObject
{System.Runtime.Remoting.Proxies.__TransparentProx y}
-__identity
-[System.Runtime.Remoting.Proxies.RemotingProxy]
{System.Runtime.Remoting.Proxies.RemotingProxy}
:
:
:
:
TypeName "System.Windows.Forms.TreeNode"
BackColor <error: cannot evaluate field of a proxy object>
: "
: "
(List of properties)
: "
: "
: "
TreeView <error: cannot evaluate field of a proxy object>

then you should be able
to access the properties just like anything else.


Unfortunately not.
Look the above-mentioned values. :-(

However, you might want to consider using some other kind of data
container besides a tree node,


But _it's_ a TreeNode.
as the tree node is part of a visul
component, and transporting those kinds of things across app-domains
can have a bad effect.


But TreeNode is derived from MarshalByRefObject.
The help says 'MarshalByRefObject is the base class for objects that
communicate across application domain boundaries by exchanging messages
using a proxy.'

There's no solution using Remoting, Proxies?

Hope this helps.


Yes and no.
It seems drag-dropping TreeNodes is impossible an so there's no solution.
:-(

p

Nov 15 '05 #4
Nicholas Paldino [.NET/C# MVP] wrote:
Peter,
Nicholas,

Thanks for your help.

Using remoting/proxies in this case is overkill, as it seems you
just want to drop a snippet of data into another application. This
snippet doesn't have any affinity to the app-domain it came from
(like a window handle, or something of that nature), so you should
make it a serializable instance and then transport that across to
your other program.
What do you mean?
Make the class Blabla.Node [Serializable]?
How to transport? Not by Drag&Drop?
It is the MarshalByRefObject base class that is
causing the problem.


There's no solution?

p
Nov 15 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Grey | last post: by
3 posts views Thread by Goldwind | last post: by
reply views Thread by Norbert | last post: by
1 post views Thread by Terry Olsen | last post: by
3 posts views Thread by VB Programmer | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.