I am updating my UI on non-UI thread, and no problems!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Of course I am not doing that because I "should not" do that. But can anybody
answer with certainty why I can't do that, other than my application "may"
crash, and why?

I understand that for example a collection has an iterator state, but what
about a TextBox, why can't I update TextBox??

(Please do not respond that I should post/send message onto UI thread,
that's not what I am asking. Thanks in advance.)
 
You can't do it because Windows doesn't support cross-thread window
communications. It's similar in C++ to accessing memory shortly after it has
been freed--there are circumstances where it works; but it's merely by
accident. As you application evolves it may eventually change the system
state so that that cross-thread control communication fails (randomly,
intermittently) and your only recourse is to not perform the cross-thread
communiation.
 
Back
Top