CAST HELP

Posted by Roger Blanchard on 13-Mar-2010 14:09

I am trying to convert the following VB.NET code to ABL.

Dim responseType as ENResponseType

responseType = CType(response.Type.GetValue(),ENResponseType);

I have tried the following but get Incompatible data types in expression error.

DEFINE

VARIABLE oResponseType AS CLASS ENResponseType NO-UNDO.

oResponseType = CAST (oResponse:TYPE:GetValue(), ENResponseType ).

The C# equivalent is

ENResponseType responseType = (ENResponseType)response.Type.GetValue();

Any help would be greatly appreciated.

All Replies

Posted by jquerijero on 15-Mar-2010 10:36

You will need to add a referenece to the assembly that contains ENResponseType. This looks like a QuickBooks type.

Posted by Roger Blanchard on 15-Mar-2010 10:45

Hello Joseph,

It is a Quickbooks type. I do have a reference to the assembly with the following.

USING

Interop.QBFC8.*.

I ended up using my old preprocessors that we used when using com. I am not sure why it does not like the CAST but it does not.

IF

oResponse:TYPE:GetValue() EQ {&rtAccountQueryRs}

Thanks for the reply.

Posted by Admin on 15-Mar-2010 10:54

It is a Quickbooks type. I do have a reference to the assembly with the following.

USING

Interop.QBFC8.*.

 

Have you added an assembly to the assemblies.xml as well? The runtime needs to have access as well - the USING statement has no effect when the .dll file is not available.

Posted by Roger Blanchard on 15-Mar-2010 10:57

Yes.

This thread is closed