Search code examples
c#.netwinformsfingerprintaxhost

Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown


I am getting an error in my simple project.

This is my code:

if (axZKFPEngX1.InitEngine() == 0) {
    label1.Text = "Connected";
}
else {
    label1.Text = "Connection Failed";
}

I already added reference composites AxInterop.ZKFPEngXControl and Interop.ZKFPEngXControl.

While debugging, I click the button, and a warning appears:

InvalidActiveXStateException was handled.

"Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown"**


Solution

  • try to call CreateControl() from your component first.