By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,584 Members | 1,774 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,584 IT Pros & Developers. It's quick & easy.

How do I extract my data from a Drag & Drop ComObject?

P: n/a
I’m trying to drag & drop listview items between two instances of my app. The
actual data that’s passed in DoDragDrop is an arraylist that’s been
serialized to a memorystream. The contents of the arraylist are objects of a
simple, serializable custom class that allows the recipient listview to
reconstruct the dragged listitems. (the contents of the arraylist actually
don’t matter…they can be simple integers and the issues in this post remain
the same)

When I’m dragging & dropping within an instance of my app, e.Data from the
DragDrop event is a DataObject and I can extract my memorystream, deserialize
it, and I’m good. However, when I drag & drop to another instance of my
application, e.Data is a System.__ComObject. Attempting to extract my data
with the normal e.Data.GetData method results in a memorystream that’s,
according to the Locals window, a
System.Runtime.Remoting.Proxies.__TransparentProxy , which is beyond the scope
of my VB knowledge. Regardless, it doesn’t deserialize, and now I’m stuck.

So could someone kindly explain what I need to do to the __ComObject to get
my memorystream out? Here’s my code:

If e.Data.GetDataPresent("System.IO.MemoryStream") Then
Dim Formatter As New BinaryFormatter
Dim Stream As New System.IO.MemoryStream
Dim DropList As New ArrayList

Stream = e.Data.GetData("System.IO.MemoryStream")
Stream.Position = 0
DropList = Formatter.Deserialize(Stream)
Any help would be appreciated.

Neil

Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Neil,

I am having the exact same problem and was disappointed to see that
nobody replied... Did you find a solution that you could share?

John

"Neil West" <Ne******@discussions.microsoft.com> wrote in message
news:15**********************************@microsof t.com...
I'm trying to drag & drop listview items between two instances of my app.
The
actual data that's passed in DoDragDrop is an arraylist that's been
serialized to a memorystream. The contents of the arraylist are objects
of a
simple, serializable custom class that allows the recipient listview to
reconstruct the dragged listitems. (the contents of the arraylist
actually
don't matter.they can be simple integers and the issues in this post
remain
the same)

When I'm dragging & dropping within an instance of my app, e.Data from the
DragDrop event is a DataObject and I can extract my memorystream,
deserialize
it, and I'm good. However, when I drag & drop to another instance of my
application, e.Data is a System.__ComObject. Attempting to extract my
data
with the normal e.Data.GetData method results in a memorystream that's,
according to the Locals window, a
System.Runtime.Remoting.Proxies.__TransparentProxy , which is beyond the
scope
of my VB knowledge. Regardless, it doesn't deserialize, and now I'm
stuck.

So could someone kindly explain what I need to do to the __ComObject to
get
my memorystream out? Here's my code:

If e.Data.GetDataPresent("System.IO.MemoryStream") Then
Dim Formatter As New BinaryFormatter
Dim Stream As New System.IO.MemoryStream
Dim DropList As New ArrayList

Stream = e.Data.GetData("System.IO.MemoryStream")
Stream.Position = 0
DropList = Formatter.Deserialize(Stream)
Any help would be appreciated.

Neil

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.