VB.NET OLE Declaration

  • Thread starter Thread starter =?ISO-8859-1?Q?Bernard_Bour=E9e?=
  • Start date Start date
?

=?ISO-8859-1?Q?Bernard_Bour=E9e?=

I want to use an OLE Automation Interface called XXX developped by a
third party and have the following declarations:

Public oAB As XXX.Application 'Amibroker Apllication
oAB = CreateObject("XXX.Application")
Dim oStocks As Broker.Stocks
Dim oStock As Broker.Stock
Dim iStockQty As Short
iStockQty = oStocks.Count

The last line give me a NullReferenceException error
I have tried to use NEW after As but still obtain the same error.

What is the correct syntax ?

Thanks

Bernard
 
The oStocks variable has not been assigned, therefore you get a
NullReferenceException. It seems that a line like the following is missing:

oStocks = oAB.X()

before using

iStockQty = oStocks.Count


--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top