Exposing String Dictionary to COM

  • Thread starter Thread starter Steve Long
  • Start date Start date
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
 
Back
Top