I often post on subjects that frequently become of relevance to post within the Smart Device MSDN forums. Today's item of interest is updating controls from worker threads. ALl too often a developer new to programming on Windows devices will start a worker thread to perform a process then update a textbox, progress bar, or other control from the worker thread and wonder why it won't work.
To make a long story short you should never directly updte a UI element from a secondary thread. A UI control is owned by the thread on which it was created. No other thread can manipulate that control directly. Instead request to update the control must be marshaled to the owning thread. Controls within the .Net framework have a method named Incoke that will marshal method calls for you.
Tags: