Click here to Skip to main content
15,172,754 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have code about OCR from your site. But it doesnt work

throw AxHost.InvalidActiveXStateException

I have VS2008 windows 7 x64 Office 2007

after line

this.axMiDocView1 = new AxMODI.AxMiDocView();

in watch list I have for ex

ActionState 'axMiDocView1.ActionState' threw an exception of type 'System.Windows.Forms.AxHost.InvalidActiveXStateException' MODI.MiActionState {System.Windows.Forms.AxHost.InvalidActiveXStateException}

and the same for other fields.
how can I fix this problem ?

For each and every active x control, it is needed to create it first, so that all the events and handles should be initialized.

Use axMiDocView1.CreateControl()
codetaino 13-Jan-12 7:56am
thanks this solved my problem!
011010 16-Feb-12 5:30am
Thanks a lot bro CreateControl() worked for me
rsdnitesh 21-Mar-12 10:05am
I am using AxMSTSCLib.AxMsTscAxNotSafeForScripting activex component for open RemoteDesktop on a windows forms code is given below

Dim RDP As New AxMSTSCLib.AxMsTscAxNotSafeForScripting
RDP.Server = "Servername"
RDP.UserName = "user"
Dim s As IMsRdpClientNonScriptable = DirectCast(RDP.GetOcx(), IMsTscNonScriptable)
s.ClearTextPassword = "PWD"

code works fine but when i run the program the control is not visible.

How to fix this??
At a guess I would say that the ActionState of the MiDocView control is set to a value that is no longer valid under Office 2007.

Open Form1 in design mode and select the axMiDocView1 control, then look at the properties for the control, under Misc there is a property called ActionState, set this to a different value and see what happens. You may need to remove and readd the reference to the MODI ocx control as well.
Look here

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900