InvalidActiveXStateException accessing OCX
Posted on 2003-10-26
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
private AxACQUIRELib.AxAcquire axAcquire1; // this is the OCX wrapper
this.axAcquire1 = new AxACQUIRELib.AxAcquire(); // Instantiate the wrapper
this.axAcquire1.Acquire(… (ellipsis)); // Constructor exported by OCX
The constructor call gets the InvalidActiveXStateException.
1. What am I doing wrong?
2. Any good references (books or web pages) ?