InvalidActiveXStateException Error

< Back
You are here:
Print

InvalidActiveXStateException Error

This error is due to the ActiveX Control not being completely initialized when the textBox1_TextChanged event is called as the form loads. This behavior is by design in VS.NET and is largely due to the relative slowness of calling ActiveX controls in the managed code environment.

InvalidActiveXStateException Error

The workaround is to handle the error using a try|catch statement and then re-attempt the offending code after the component has been completely initialized.

An example of the try | catch in VB would be:

Try
AxBarCode1.DataToEncode = TextBox1.Text
Catch ex As AxHost.InvalidActiveXStateException
End Try