Saturday, September 8, 2007

CrossThreadException

Cross thread exceptions occur when a UI control is accessed from a thread other than the one on which it is created.

This may be due to the fact that the worker thread which owns the control would be busy with UI activities such as painting that control, displaying text, etc. As a result, any statement which interfers with the UI needs to be marshalled using the method Control.Invoke().