سؤال

I am continuously struggling with this exception

An unhandled exception of type 'System.Windows.Forms.AxHost.InvalidActiveXStateException' occurred in AxInterop.SBXPCLib.dll

any help please, am i missing some thing.

هل كانت مفيدة؟

المحلول

Try this,it will solve your 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.

So try this:

axMDocView1.CreateControl()

نصائح أخرى

The answer by Vishal is Fulfill your requirement but here I wanted to add one more thing with it. If you wanted to reflected this changes via all the threads and not only by calling thread (in multiple thread scenario) then use

axMDocView1.CreateControl();
axMDocView1.SkinAllThreads();

Actually in multiple threading scenario if your skinning code is in one of the thread then may be it is not reflect change for other current thread so at that time this code is play important role in it.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top