Click here to Skip to main content
15,867,568 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm new to Visual Basic, and I've run into an error. I'm trying to write a program that will eventually be run by and in Sterling Trader (stock-trading software). I'm trying to follow the instructions of the activeX API guide for including the reference to the library. Here's what the guide says:


Create a reference to the Sterling ActiveX Library
- Select Project ---> References....from the menu
- Select Sterling 1.0 Type Library from the Available References.
- If the Sterling 1.0 Type Library is not found, select Browse and find the Sterling.tlb file.

Enable Events
- Place the following line in the general section of your code to declare the object:
VB
Dim WithEvents m_STIEvents As STIEvents

- Place the following line in an initializing procedure, such as the Form_Load procedure:
VB
Set m_STIEvents = New STIEvents

- Now select m_STIEvents in the Object drop down control in your code window (top left drop down control). You will see the available events in the Procedure drop down control (top right drop down control). Select the event that you would like to catch and it will be inserted into your code. It should look
something like this:
VB
Private Sub m_STIEvents_OnSTIOrderUpdateMsg(ByVal oSTIOrderUpdateMsg As
ISTIOrderUpdateMsg)

- Use the oSTIOrderUpdateMsg object to gather the information from the message.



However, for some reason I was getting errors in Visual Basic 2010 (the guide must be out of date). So basically, I blindly followed Intellisense to change my code to something that I hoped would work. Here's my code:



VB
<code>
Public Class Form1

    Dim WithEvents m_STIEvents As SterlingLib.STIEvents

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

       m_STIEvents = New SterlingLib.STIEvents

    End Sub


End Class

</code>

For now, I'm just trying to get a basic program up and running that has successfully include the library. However, when I run this, I get the following error message:

"Retrieving the COM class factory for component with CLSID {5E89F49B-6A12-420F-8570-E510EF1B580A} failed due to the following error: 80070002 The system cannot find the file specified (Exception from HRESULT: 0x80070002)"

If I click continue, the program runs and the basic window displays. I can't find anything online for how to do this at all, please help!

Thanks,
Jeff
Posted
Updated 11-Sep-12 7:32am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900