473,395 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

C# to COM interop call returning an array of objects.

Hello,

The following code makes an interop call to a Com object
from C#:
//Create a Bom object
NewsBusObjsRCW.NewsBomObjClass myNewsBom = new
NewsBusObjsRCW.NewsBomObjClass();

//Get the parts array
NewsBusObjsRCW.NewsPartObjClass[] myNewsPartArray =
myNewsBom.theNewsLocObject.theNewsRevObject.theNew sPartObje
ctArray;
When I do a build I get the following error:

Property, indexer, or event 'theNewsPartObjectArray' is
not supported by the language; try directly calling
accessor
methods 'NewsBusObjsRCW._NewsRevObj.get_theNewsPartObjectA r
ray()'
or 'NewsBusObjsRCW._NewsRevObj.set_theNewsPartObjectA rray
(ref NewsBusObjsRCW.NewsPartObj[])'
The interop calls work fine for other attributes of the
NewsRevObj (the following code works fine):

string myName =
myNewsBom.theNewsLocObject.mtheNewsRevObject.theNa me
There is a problem with returning an array of objects.
Can anyone help me out with this?

Thanks,
Dave

Nov 15 '05 #1
2 2303
Man, this message looks like Deja Vu. I could have sworn I've seen it here
before. Do a search on Google groups and I'll bet money that you find your
answer.

Pete

"Interop newbie" <an*******@discussions.microsoft.com> wrote in message
news:04****************************@phx.gbl...
Hello,

The following code makes an interop call to a Com object
from C#:
//Create a Bom object
NewsBusObjsRCW.NewsBomObjClass myNewsBom = new
NewsBusObjsRCW.NewsBomObjClass();

//Get the parts array
NewsBusObjsRCW.NewsPartObjClass[] myNewsPartArray =
myNewsBom.theNewsLocObject.theNewsRevObject.theNew sPartObje
ctArray;
When I do a build I get the following error:

Property, indexer, or event 'theNewsPartObjectArray' is
not supported by the language; try directly calling
accessor
methods 'NewsBusObjsRCW._NewsRevObj.get_theNewsPartObjectA r
ray()'
or 'NewsBusObjsRCW._NewsRevObj.set_theNewsPartObjectA rray
(ref NewsBusObjsRCW.NewsPartObj[])'
The interop calls work fine for other attributes of the
NewsRevObj (the following code works fine):

string myName =
myNewsBom.theNewsLocObject.mtheNewsRevObject.theNa me
There is a problem with returning an array of objects.
Can anyone help me out with this?

Thanks,
Dave

Nov 15 '05 #2
Dave,

So did you try what was suggested in the error message?

NewsBusObjsRCW.NewsPartObjClass[] myNewsPartArray =
myNewsBom.theNewsLocObject.theNewsRevObject.get_th eNewsPartObjectArray();

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.
Nov 15 '05 #3

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

Similar topics

1
by: Nadav | last post by:
Hi, Introduction *************** I have a system build of a collection of 'Native COM objects' and '.NET COM interop' objects, all of the COM objects are managed through a 'Native COM' layer,...
4
by: C# beginner | last post by:
Hi all I am trying to call my C# class library from COM. My C# library works perfectly in the .NET environment. I have registered my C# component using regasm and also placed it in the GAC. But...
2
by: Boris | last post by:
The .NET documentation talks about blittable and non-blittable types. While objects of type System::Object* are non-blittable it doesn't say anything about objects of user-defined classes. All the...
4
by: DotNetJunkies User | last post by:
I am calling a VB6 dll from a vb.net windows application that returns an array of strings. My issue is it seems to truncate after a NULL character. For Example VB 6 is returning a string with the...
17
by: Aaron | last post by:
I've got a doozie of a problem! I and others have been trying to figure this out for too long and I've come to the conclusion that I should probably look for some support.. Ok, I have a COM...
6
by: Scott M. Lyon | last post by:
As I mentioned in my other post, I'm attempting to, using COM Interop so I can update existing VB6 code to (for several specific functions) return a Hashtable from a .NET library. I've had...
5
by: Richard Lewis Haggard | last post by:
I am trying to create multi-dimensioned arrays in conventional ASP pages and pass these arrays as arguments to functions that are in a C# interop assembly. ASP complains because it doesn't...
1
by: Brendan Grant | last post by:
I’ve got a C# library that I’ve built into a COM component that will be used from a VC++ 6 application and while the creation of the COM object side of things seem to be working fine, using the...
2
by: Torsten Z | last post by:
Hi, I have tried several things to passing an array of objects or a Object Collection from .NET to VB6 but I can't get it work. Passing one object works fine, but more than one not. Has anybody...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.