Click here to Skip to main content
15,029,464 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:

I have two classes that want access one method, class1 in class2 (with delegates) but when run, this exception occurred:

System.InvalidOperationException (The calling thread cannot access this object because a different thread owns it.) 

"I have two class one class access graphical layer and second class is Calculation layer, but i want when calculation is running as parallel show graphical that i want
access one method in class1 that do this work. and class2 create class1 "

Is it possible to access another method? If so, how?

Updated 8-Dec-11 20:02pm
Al Moje 9-Dec-11 1:44am
Could you post your code so that we could see?
It depends on that object, but shared resources should be used though synchronization primitives.

1 solution

Looks like you are using WPF ? Have you tried BackgroundWorker[^] ? It reports progress on UI thread. Or read about Dispatcher.Invoke (WPF/WinForms)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900