Exposing String Dictionary to COM

S

Steve Long

Hello,
I'm trying to expose a string dictionary to a COM client (VB6) and I'm
having some trouble with the Keys property of the StringDictionary.
My class is laid out as such:
The problem is that when I hit the Keys property VB6 says that the object
doesn support the method or property. Help???

<ClassInterface(ClassInterfaceType.AutoDual),
Guid("F04A8EDA-C857-4dec-BFCA-A41744CAB48B")> _
Public Class Dictionary
Inherits StringDictionary

Public Sub New()
MyBase.New()
End Sub

Public Overrides Sub Add(<MarshalAs(UnmanagedType.BStr)> ByVal key As
String, _
<MarshalAs(UnmanagedType.BStr)>
ByVal item As String)
MyBase.Add(key, item)
End Sub

Public Overrides Sub Remove(<MarshalAs(UnmanagedType.BStr)> ByVal key As
String)
MyBase.Remove(key)
End Sub

Public Overrides ReadOnly Property Keys() As
(<MarshalAs(UnmanagedType.BStr)> String()
Get
Dim s(MyBase.Count - 1) As String
MyBase.Keys.CopyTo(s, 0)
Return s
End Get
End Property

.... Other implementation omitted for brevity
End Class
 
S

Steve Long

Never mind,
I switched from inheritance to containment and it works better now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top