473,473 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

COM Interop, Collections, and _Enum

I've got a 2.0 .NET assembly class that I need to expose to COM.
Most of the items in it's interface are pretty straight forward,
booleans, strings, etc.

One property however, returns a HashTable when consumed in .NET. What's
the sanest way to get this data out of .NET from within COM, and still
be able to treat it like it has an _Enum interface?

I started down the path of creating a new class, MyCollection, that
inherits HasTable. That class has ComDefaultInterface set to
IDictionary, and MyCollection Implements the IDictionary interface.

Within COM, I can instantiate the parent class, get back the
MyCollection class from the property in question. I can act on that
class using the usual clear/contains/add type things.

From here, I'm totally lost as to where to go next to be able to tack on
an _Enum to allow COM to be able to enumerate my class collection:

Set objParent = CreateObject("My.NET.Assembly")

objParent.MyCollection..Add("foo", "bar")

For Each objItem In objParent.MyCollection
...
Next

Is such a thing even possible, is this the dark nasty part of COM interop?

-=Chris
Feb 23 '06 #1
0 959

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

Similar topics

0
by: sergi | last post by:
Hi there, I am getting a System.NullReference exception when calling an unmanaged method CreateClassEnumerator. I am really new to Interop, so that I am having trouble finding out a solution....
1
by: Santy | last post by:
Hi. I made a class in c#. Enabled the COM Interop and DLL and TLB(myClass.tlb) was made. After this, I created a C++ project. I wanna use the previous .NET/COM c# class in my new C++ project....
0
by: Steven Kilby | last post by:
I have a component (inproc dll) written in VB6. I have a client written in C#. If I compile the component to native code everything works fine. I add the necessary type library for my component...
26
by: Vish | last post by:
Hi, I am trying to expose my .NET 2.0 class as a COM type using the following attributes for the attributes I have the "Register for COM Interop" build property set to true. I also have...
16
by: Asaf | last post by:
I am trying to create and use a COM object with C#.NET 2005. The assembly is set to "Register for COM interop" but when I am trying to call it from VB on Word 2003 I am getting this error: ...
6
by: Nataraj1978 | last post by:
I have a requirement to use a dll written in Visual C++ 6.0 in my C# application. In order to establish the link between my application and the dll, I have written a ATL COM Component in Visual...
1
by: Darwin | last post by:
I am trying to register a .Net class for COM interop in VS2005. When I went to add a class there was no "COM class" as a template, so I am trying to code it myself. But I keep getting "... does not...
3
by: =?Utf-8?B?VGVycnk=?= | last post by:
I have made up a contrived example show the problem I am having. I have some ReadOnly interfaces: Public Interface IROPerson ReadOnly Property FirstName() As String ReadOnly Property LastName()...
0
by: Michel Walsh | last post by:
I got the following error: ============= Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)) ============= when using Interop.Excel.Run. The relevant code is from...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.