Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7606269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T00:22:02+00:00 2026-05-31T00:22:02+00:00

I’m having an issue involving the following scenario, Application A has a DataGridView, from

  • 0

I’m having an issue involving the following scenario, Application A has a DataGridView, from which objects are selected. They are dragged into a DataGridView inside Application B, and the objects are copied into the new list. Here is the code in App A, preparing the dragdrop:

       ArrayList ToDrag = this.GetSelectedBoundItems();
       DataObject data = new DataObject(ToDrag);
       this.DoDragDrop(data, DragDropEffects.Move | DragDropEffects.Copy);

The problem: the recieving end is unable to get the ArrayList. Here is the code for that:

 //formats has the value of "System.Collections.ArrayList"
 var formats = myRetrievedObject.GetFormats();

 //candoit has the value "true"
 var candoit = myRetrievedObject.GetDataPresent(typeof(ArrayList));

 //DraggedItems is of type "System.__ComObject"
 var DraggedItems = myRetrievedObject.GetData(typeof(ArrayList));

 //this returns null.  I 'think' this should work
 ArrayList DraggedItems2 = myRetrievedObject.GetData(typeof(ArrayList)) as ArrayList;

 //This throws an exception (see below)
 ArrayList DraggedItems2 = (ArrayList)myRetrievedObject.GetData(typeof(ArrayList)) as ArrayList;

This used to work. Two things have happened to this, we jumped from .net 2.0 to .net 4.0, and this code was translated into C++.net into C#.

I’m not sure what I’m missing. That data is supposed to be translated into an array list.

Thanks for the help!

edit this is the exception text from the cast

A first chance exception of type ‘System.InvalidCastException’ occurred in dfResultsControls.dll

Additional information: Unable to cast COM object of type ‘System.__ComObject’ to class type ‘System.Collections.ArrayList’. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T00:22:04+00:00Added an answer on May 31, 2026 at 12:22 am

    Making the (data) object serializable solves the problem for me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a text area in my form which accepts all possible characters from
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.