fix the problem - Cross-thread operation not valid

P

Petr Jenicek

Hello,
I have my dll assembly with threads and events. I use this assembly in win
form application and information from assembly events want to display in
win form control. But this way of using cause exception "Cross-thread
operation not valid....." Can I fix this problem in my dll assembly or there
is only one way to fix this problem in win form application ?

Thank you
Petr
 
M

Michael Nemtsev [MVP]

Hello Petr,

You can only update a UI control from the same thread where it has been created.
So you need the event-bases aproach to update your UI asynchroniously http://www.yoda.arachsys.com/csharp/threads/winforms.shtml

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


PJ> Hello,
PJ> I have my dll assembly with threads and events. I use this assembly
PJ> in win
PJ> form application and information from assembly events want to
PJ> display in
PJ> win form control. But this way of using cause exception
PJ> "Cross-thread
PJ> operation not valid....." Can I fix this problem in my dll assembly
PJ> or there
PJ> is only one way to fix this problem in win form application ?
PJ> Thank you
PJ> Petr
 

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