Possible Duplicate:
.NET Controls: Why aren’t all calls thread-safe?
This question i开发者_JAVA技巧s not about what is a cross-thread operation, and how to avoid it, but why internal mechanics of .NET framework does not allow a cross-thread operation.
I can`t understand why a SerialPort DataReceived event cannot update a simple text box on my form and why using delegates this is possible?
.NET allows cross-thread operations. But you should handle it safely. Use Invoke
/ BeginInvoke
methods for cross-thread operations. Invoke means "Hey, text box! Please update yourself when you will have time." Here is an example of usage on MSDN
精彩评论