Sign in to follow this  
avinash

how to resolve InvalidActiveXStateException while loading chart?

Recommended Posts

Hi Rahul,

  I am getting following exception while plotting chart.

ex = {"Exception of type 'System.Windows.Forms.AxHost+InvalidActiveXStateException' was thrown."}

 This is my code:

FC = new AxShockwaveFlashObjects.AxShockwaveFlash();

FC.Movie = Application.StartupPath + "FusionChartsFCF_Bar2D.swf?chartWidth=220&chartHeight=300";

FC.MovieData = chartURL;

FC.Play();

plz reply...how to resolve it

Thanking you,

Avinash

Share this post


Link to post
Share on other sites

Hi Avinash,

You are getting this message because you are just creating an object of AxShockwaveFlashObjects.AxShockwaveFlash(); and not adding FC into the Form's Control.

You need to use this.Controls.Add(FC); like the following code:

 

FC = new AxShockwaveFlashObjects.AxShockwaveFlash();

this.Controls.Add(FC);

FC.Movie = Application.StartupPath + "FusionChartsFCF_Bar2D.swf?chartWidth=220&chartHeight=300";

FC.MovieData = chartURL;

FC.Play();

Edited by Guest

Share this post


Link to post
Share on other sites

Thanx Rahul,

  It works fine........

but it was creating new form control also.

I want to show flash movie on same form control .........i dont want to create new form

plz reply

Avinash

Share this post


Link to post
Share on other sites

Hi Avinash,

If you don't want to add new control then you need not create a new chart Object. You can do the same as following way:

FC.Movie =

Application.StartupPath + "FusionChartsFCF_Bar2D.swf?chartWidth=" + FC.Width.ToString() + "&chartHeight=" + FC.Height.ToString();

//dataXML method

FC.SetVariable(

"dataXML","<graph><set value='10' /></graph>");

//dataURL method

FC.SetVariable("dataURL", "Path to XML file");

Otherwise try this:

int oldHeight = FC.Height;

int oldWidth = FC.Width;

int oldTop = FC.Top;

int oldLeft = FC.Left;

FC.Dispose();

FC = new AxShockwaveFlashObjects.AxShockwaveFlash();

FC.Height = oldHeight;

FC.Width = oldWidth;

FC.Top = oldTop;

FC.Left = oldLeft;

this.Controls.Add(FC);

FC.Movie =

Application.StartupPath + "FusionChartsFCF_Bar2D.swf?chartWidth=220&chartHeight=300";

FC.MovieData = chartURL;

FC.Play();

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this