AB.Stock.Quotations.Retrieve in C#

I am having problems retrieving quotes in C#. This picture shows my error in code. Please help.

Retrieve() is provided for VBA/VBScript. Only they support OLE SAFEARRAYS. You don't pass plain float arrays to Retrieve(). You pass OLE SAFEARRAY references. I don't think that you can use them with C#. And it is not you who allocates arrays, but Retrieve(). Retrieve allocates SAFE arrays and returns them the way how VBA/VBScript expects (as OLE Variants)

Thanks Tomasz. I have been successful using Retrieve() with Visual Basic in Visual Studio. Works great with the arrays needed. I still don't know why we can't get an equivalent way of doing it in C#.

Retrieve function was provided for VB/VBA/VBScript users because when it was implemented (something like 20 years ago), it was popular and C# on the other hand did not exist at all. Visual Basic works with VARIANTS. VARIANT is a OLE/COM method of storing value of "any" type. C# does not support that out of the box. There are ways to force C# to use variants but it is outside the scope of this forum. See https://www.google.com/search?q=variant+in+C%23

Nowdays, there is no reason to use Retrieve at all, as you can do everything directly in AFL much faster without resolving to old-style COM/OLE objects.

For example if you want to export quotes, you can export directly to files from AFL (fopen/fputs/fclose)

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.