472,378 Members | 1,316 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,378 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 2240
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: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: Johno34 | last post by:
I have this click event on my form. It speaks to a Datasheet Subform Private Sub Command260_Click() Dim r As DAO.Recordset Set r = Form_frmABCD.Form.RecordsetClone r.MoveFirst Do If...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

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.