Hello Rick!
I use the great program! So far all trouble free. But my program (.NET Basic) I create my own classes for the exchange of messages. Some of my classes is inherited classes. GetPropertyCom does not return the properties of the base class properties, and it also runs a bug (FoxPro side) in such cases. Eg. business customer datas exchange class, and exchange property:
loDatas = lobridge.GetProperty(loRequest, "taxPayerData")
?loadatas.taxPayerValidity
?lodatas.countryCode && property of base class
Thrown error!
But this class is inherited class:
Public Class taxPayerDatas
Inherits TaxpayerAddressType
Private taxPayerValidityfield As Boolean = False
Private taxPayerNamefield As String = String.Empty
Public Sub New()
MyBase.New()
End Sub
Public Property taxPayerValidity As Boolean
Get
Return taxPayerValidityfield
End Get
Set(value As Boolean)
taxPayerValidityfield = value
End Set
End Property
Public Property taxpayerName As String
Get
Return taxPayerNamefield
End Get
Set(value As String)
taxPayerNamefield = value
End Set
End Property
End Class
This is not working. If I implemented only TaxpayerAddressType class, call directly (this is default / original classes) everything works.
I welcome all the help!
Best Regards, Géza
You probably need to use GetProperty()
on the retrieved object:
? lodatas.taxPayerValidity && Works because declared type
*** COM does not support auto-mapping of .NET inherited types
*** so use indirect referencing
? loBridge.GetProperty(lodatas,"countryCode")
Hello!
Thank you for you fast response. But the problem is biggest: In this case, also the defined roperties is cause an error!
LOCAL lotaxpayerdatas
lotaxpayerdatas = loBridge.GetProperty(loRequest,"taxPayerData")
IF !ISNULL(lotaxpayerdatas )
? lotaxpayerdatas.taxPayerValidity
?? "**"
ENDIF
Ole error Unknown COM status code!
IF I removed / commented the Inherited class definiton all is OK!
Public Class taxPayerDatas
'Inherits TaxpayerAddressType
Private taxPayerValidityfield As Boolean = False
Private taxPayerNamefield As String = String.Empty
Best Regards Geza
Whenever a property is not accessible try using GetProperty()
or SetProperty()
. COM does not support all types that .NET can expose to FoxPro. Generic types, structs, value types, raw enums are just a few examples of things that you can't access directly but will work with Get/SetProperty.
+++ Rick ---
Thank you, for your fast response! Both solutions work!
LOCAL lotaxpayerdatas
lotaxpayerdatas = loBridge.GetProperty(loRequest,"taxPayerData")
IF !ISNULL(lotaxpayerdatas )
? loBridge.GetProperty(lotaxpayerdatas,"taxPayerValidity")
? loBridge.GetProperty(lotaxpayerdatas,"taxpayerName")
? loBridge.GetProperty(lotaxpayerdatas,"countryCode")
? loBridge.GetProperty(lotaxpayerdatas,"postalCode")
? loBridge.GetProperty(lotaxpayerdatas,"city")
? loBridge.GetProperty(loRequest,"taxPayerData.taxPayerValidity")
? loBridge.GetProperty(loRequest,"taxPayerData.taxpayerName")
? loBridge.GetProperty(loRequest,"taxPayerData.countryCode")
? loBridge.GetProperty(loRequest,"taxPayerData.postalCode")
? loBridge.GetProperty(loRequest,"taxPayerData.city")