By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,693 Members | 1,264 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,693 IT Pros & Developers. It's quick & easy.

VB.NET OLE Declaration

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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

"Bernard Bourée" <be*****@bouree.net> escribió en el mensaje
news:%2***************@TK2MSFTNGP12.phx.gbl...
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

Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.