josgood
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 InvalidActiveXStateExcepti on.
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 InvalidActiveXStateExcepti on.
Two questions:
1. What am I doing wrong?
2. Any good references (books or web pages) ?
Thank you.
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 InvalidActiveXStateExcepti
Two questions:
1. What am I doing wrong?
2. Any good references (books or web pages) ?
Thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.