Windows Develop Bookmark and Share   
 index > Windows Forms General > System.Windows.Forms.AxHost.InvalidActiveXStateException was unhandled
 

System.Windows.Forms.AxHost.InvalidActiveXStateException was unhandled

hello all

i got this error with windows media player control as i am assigning  url of media control to media clip in temp folder

can any body please help me

early thanks

Ramanakumar  Wednesday, September 06, 2006 12:07 PM
Bjørnar Sundsbø  Wednesday, September 12, 2007 11:53 AM
ahmedilyas  Wednesday, September 06, 2006 12:53 PM

I'm having some problems with this exception as well. I have an AxMapControl provided by the vendor, and I am extending the control. When adding the control to the Controls collection of a UserControl where I want to display it using the toolbox, it works just fine. However, when adding the control programatically, I get the exception mentioned in this thread. InitializeComponent for my derived class is already executed when trying to set a property on the ActiveX. The same code that worked when running after adding the control from the toolbox, fails now.

I've tried to do everything the designer does, with no luck. I've even copied the content of the OcxState from the resource file and set it to the OcxState of my control, with no luck.

I understand why the exception occurs based on the help in the msdn documentation, but I don't know how to work around it.

Any ideas?

Bjørnar Sundsbø  Wednesday, September 12, 2007 11:22 AM
Bjørnar Sundsbø  Wednesday, September 12, 2007 11:53 AM

I have the same scenario, and i resolve the problem invoking this method before:

YourActivexControl.CreateControl();

This has been resolve the problem in my case.

Daniel Hefez.

  • Proposed As Answer byebread Tuesday, September 22, 2009 11:14 AM
  •  
dhefez  Monday, June 02, 2008 2:22 PM

Thanks very much !

Jiang Xu  Friday, November 21, 2008 6:34 AM
Same problem (InvalidActiveXStateException) same awnser: CreateControl.
Thanks,
Koob
KoobPA  Thursday, March 12, 2009 1:16 PM
YourActivexControl.CreateControl();

solve my problem. Thanks
ebread  Tuesday, September 22, 2009 11:13 AM

You can use google to search for other answers

Custom Search

More Threads

• SuspendLayout() Doesn't Work when Resizing?
• how can we change the input locale programmatically using C#
• OnPaint is called for each child?
• WebBrowser control and add-ons
• sql statements...
• ToolStripComboBox Menu Close problem
• Syntax highligth in rich textbox
• How to make a MSN Status Changer? Or How to Embed MSN? and More... Help Please!
• C# core programming issues
• how to add RichTextBox in Toolbox?