Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: problem with backgroundworker

0
0
I am using the Microsoft.ClearScript.Windows.VBScriptEngine object.

I have it inside a large class. Everything runs just great until I call one of the class's functions with a backgroundworker.

In that scenario when I try to ExecuteCommand I get this error


"The calling thread cannot access this object because a different thread owns it."

I saw where I can call the CheckAccess() function to keep it from the error but I really really need this to work same as if it was all on a single thread.

this is how I am initiating the vb object
  WorkflowVBS = new Microsoft.ClearScript.Windows.VBScriptEngine("ALICE");
added these lines but they don't seem to help at all.
  WorkflowVBS.VerifyAccess();
  WorkflowVBS.AllowReflection = true;
There has to be a way out of this pickle. just has to be.

Viewing all articles
Browse latest Browse all 2297