I would like to create an instance o AxTChart inside my class (I'm working with C#), setup some plots, get an image. The problem is that this function is inside a method being executed in a worker thread and there is no Form associated with it.
When I do "new AxTChart()" I get an thread exception that says that I "cannot create an instance of the ActiveX control because the current segment is not in an STA (single-threaded apartment)".
What should I do?
Create an instance AxTChart in my worker thread
-
- Newbie
- Posts: 11
- Joined: Fri Jun 06, 2008 12:00 am
- Location: Brazil
- Contact:
Re: Create an instance AxTChart in my worker thread
Hello,
I don't have any example project setup to check this but it seems that the thread will probably need to be created as single thread.
eg.
If that doesn't give you the results you require and you have a small sample application you can send us we'll take a look.
Regards,
Marc Meumann
I don't have any example project setup to check this but it seems that the thread will probably need to be created as single thread.
eg.
Code: Select all
using System;
using System.Threading;
namespace testapp
{
class Class1
{
static void Main(string[] args)
{
Thread.CurrentThread.ApartmentState =
ApartmentState.STA;
}
}
}
Regards,
Marc Meumann
Steema Support