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 StringDictionar y.
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 (ClassInterface Type.AutoDual),
Guid("F04A8EDA-C857-4dec-BFCA-A41744CAB48B")> _
Public Class Dictionary
Inherits StringDictionar y
Public Sub New()
MyBase.New()
End Sub
Public Overrides Sub Add(<MarshalAs( UnmanagedType.B Str)> ByVal key As
String, _
<MarshalAs(Unma nagedType.BStr) >
ByVal item As String)
MyBase.Add(key, item)
End Sub
Public Overrides Sub Remove(<Marshal As(UnmanagedTyp e.BStr)> ByVal key As
String)
MyBase.Remove(k ey)
End Sub
Public Overrides ReadOnly Property Keys() As
(<MarshalAs(Unm anagedType.BStr )> String()
Get
Dim s(MyBase.Count - 1) As String
MyBase.Keys.Cop yTo(s, 0)
Return s
End Get
End Property
.... Other implementation omitted for brevity
End Class
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 StringDictionar y.
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 (ClassInterface Type.AutoDual),
Guid("F04A8EDA-C857-4dec-BFCA-A41744CAB48B")> _
Public Class Dictionary
Inherits StringDictionar y
Public Sub New()
MyBase.New()
End Sub
Public Overrides Sub Add(<MarshalAs( UnmanagedType.B Str)> ByVal key As
String, _
<MarshalAs(Unma nagedType.BStr) >
ByVal item As String)
MyBase.Add(key, item)
End Sub
Public Overrides Sub Remove(<Marshal As(UnmanagedTyp e.BStr)> ByVal key As
String)
MyBase.Remove(k ey)
End Sub
Public Overrides ReadOnly Property Keys() As
(<MarshalAs(Unm anagedType.BStr )> String()
Get
Dim s(MyBase.Count - 1) As String
MyBase.Keys.Cop yTo(s, 0)
Return s
End Get
End Property
.... Other implementation omitted for brevity
End Class
Comment