VFP and .NET Interop
wwDotNetBridge
Gravatar is a globally recognized avatar based on your email address. wwDotNetBridge
  Scott R
  All
  Jun 2, 2017 @ 07:15am

Rick,

I am using the wwDotNetBridge and am running into the following problem. I am loading a dll (works great) and I can great 1 instance (see code) but am getting an error on another instance and am wondering if you can point me in the write direction on why.

Fox Code that works:

DO wwDotNetBridge

oBridge = CreateObject("wwDotNetBridge","V4")

oBridge.loadAssembly('Sage_SA.SDK.dll') && load the sdk dll
IF !EMPTY(oBridge.cErrorMsg)
	mbox('Failed to Load Assembly: ' + oBridge.cErrorMsg)
	RETURN 
ENDIF 

oSageDBUtil = oBridge.CreateInstance('SimplySDK.Support.SDKDatabaseUtility') &&This works
However, when I try to create the following instance I get an error message: "Constructor on type 'SimplySDK.Support.InvoiceJournal' not found." Fox Code:
oSageInv = oBridge.CreateInstance('SimplySDK.Support.InvoiceJournal')
The documentation for the SDK dll Gives the following example in C#
public abstract class InvoiceJournal : APARJournal
Here's the rest of the documentation:

For the code that worked:

Namespace: SimplySDK.Support

Assembly: Sage_SA.SDK (in Sage_SA.SDK.dll)

C#: public class SDKDatabaseUtility

Inheritance Hierarchy

 System.Object

    SimplySDK.Support.SDKDatabaseUtility

For the code that doesn't work:

Namespace: SimplySDK.Support

Assembly: Sage_SA.SDK (in Sage_SA.SDK.dll)

C#: public abstract class InvoiceJournal : APARJournal

Inheritance Hierarchy

  System.Object

     SimplySDK.Support.Journal

        SimplySDK.Support.APARJournal

           SimplySDK.Support.InvoiceJournal

Any Direction would be appreciated. Thanks.

Scott

Gravatar is a globally recognized avatar based on your email address. re: wwDotNetBridge
  Rick Strahl
  Scott R
  Jun 2, 2017 @ 09:58am

Most likely there's no parameterless constructor for that class. Look up the class signature and check for what parameters have to be passed to the constructor.

Rick

© 1996-2017