8
I am creating a wrapper class in .NET (VB.NET as it happens but is equally related to C#) that is exposed to COM and one of the properties I am trying to wrap is a Variant. I thought I would just be able to use an Object, but I get an error:
Public Property FieldValue([vFieldID As Object = -1]) As Objectcannot be exposed to COM as a property 'Let'. You will not be able to assign non-object values (such as numbers or strings) to this property from Visual Basic 6.0 using a 'Let' statement.*
My property declaration looks like this:
Public Property FieldValue(Optional ByVal vFieldID As Object = -1) As Object
Get
Return _objVAccess.FieldValue(vFieldID)
End Get
Set(ByVal value As Object)
_objVAccess.FieldValue = value
End Set
End Property
My property actually returns a value from the database which can be integer, string, date, etc so it isn't an object in terms of COM. Is there any workaround to this to allow property Let?