InvalidActiveXStateException and Singel thread apartmet problem

S

sjurba

Hi.

I have a created a chart on a webform using OWC. Everything is working
fine. But then I try something a little more spetcular: Handeling events
like afterrender and afterlayout etc. This also works when the chart is
rendered on the client side using the object-tag and putting the
afterrender method on the aspx file using vbscript.

But now i want to do the same on the server side, in the codebehind
(.vb) file, because I want to generate a gif image with custom drawings
that is streamed to the client.

I have followed the procedure in this article:
]http://support.microsoft.com/default.aspx?scid=kb;EN-US;328275[/ur-
l]
to generate the axowc10.dll.

Then I used the AxChartSpace class, following the example in this
article:
]http://support.microsoft.com/default.aspx?scid=kb;EN-US;319557[/ur-
l]

But as I am generating a gif to be streamed, i only have code in the
codebehind file, and I am instanciating the AxChartSpace
programmatically.

Then I have debuged myself through adding the aspcompat=true in the page
properties of the aspx file and then setting the apartment state to STA
in the vb-file.

Now I get this error message:

Exception of type InvalidActiveXStateException was thrown.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Windows.Forms.AxHost+InvalidActiveXStateException: Exception of type InvalidActiveXStateException was thrown.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[InvalidActiveXStateException: Exception of type InvalidActiveXStateException was thrown.]
AxMicrosoft.Office.Interop.OWC.AxChartSpace.get_Charts() +68
......
......

The error occurs on the first refrence to the chartspace:
oChart = oChartSpace.Charts.Add

I have been searching the internet for solutions can't find anything to
help me out. Does anyone have a tip with something I can try..?
All help would be truly appreciated!

Sjur
 
S

sjurba

Thanx alot for your reply, althogh I must confess I had to read it
through a couple of times to really grasp it.

I finnaly realised that you where saying that I don't need to use the
AxChartSpace at all... But did i have to go through the whole process of
creating the AxOWC10.dll at all? Or was that just a wast of time? I
don't really get the point of it all, but now at least it works!

Now i have a bit of a problem thogh as the methods I have made for the
events seem to fail very quietly... They just give up without creating
any error messages. Is there a way I can turn on error messages for
failing events?

Thanx a million for your help!

Sjur
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top