Link to home
Start Free TrialLog in
Avatar of josgood
josgoodFlag for United States of America

asked on

InvalidActiveXStateException accessing OCX

I'm trying to use an OCX in a C# Windows Form for the first time.  My problem is that I’m getting an InvalidActiveXStateException.

The OCX is one I wrote a couple years ago in C++.  I'm learning C#.

I used the IDE to import the OCX (adding it to the ToolBox and dropping it on a form).
The Object Browser shows the methods correctly.  That says to me that I imported the OCX successfully.

In the code snippet, I use ellipsis (…) for code that’s irrelvant to this question.

public class Form1 : System.Windows.Forms.Form
{
… (ellipsis)
private AxACQUIRELib.AxAcquire axAcquire1;      // this is the OCX wrapper
… (ellipsis)
public Form1()
{
   InitializeComponent();
   this.axAcquire1 = new AxACQUIRELib.AxAcquire();  // Instantiate the wrapper
   this.axAcquire1.Acquire(… (ellipsis));            // Constructor exported by OCX
… (ellipsis)
The constructor call gets the InvalidActiveXStateException.

Two questions:
1.      What am I doing wrong?
2.      Any good references (books or web pages) ?

Thank you.



ASKER CERTIFIED SOLUTION
Avatar of kellycoinguy
kellycoinguy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial