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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Neil West

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

    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.__ComObj ect. 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.Proxie s.__Transparent Proxy, 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.GetDataP resent("System. IO.MemoryStream ") Then
    Dim Formatter As New BinaryFormatter
    Dim Stream As New System.IO.Memor yStream
    Dim DropList As New ArrayList

    Stream = e.Data.GetData( "System.IO.Memo ryStream")
    Stream.Position = 0
    DropList = Formatter.Deser ialize(Stream)


    Any help would be appreciated.

    Neil

  • JohnR

    #2
    Re: How do I extract my data from a Drag & Drop ComObject?

    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" <NeilWest@discu ssions.microsof t.com> wrote in message
    news:15CF92A7-21FB-4831-9A34-266BBD5DD9D8@mi crosoft.com...[color=blue]
    > 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.__ComObj ect. 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.Proxie s.__Transparent Proxy, 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.GetDataP resent("System. IO.MemoryStream ") Then
    > Dim Formatter As New BinaryFormatter
    > Dim Stream As New System.IO.Memor yStream
    > Dim DropList As New ArrayList
    >
    > Stream = e.Data.GetData( "System.IO.Memo ryStream")
    > Stream.Position = 0
    > DropList = Formatter.Deser ialize(Stream)
    >
    >
    > Any help would be appreciated.
    >
    > Neil
    >[/color]


    Comment

    Working...