Threads and UI Control - Invoke?

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

Guest

Hi all,

I have an application which has a thread that raises events. The event
handler updates the UI.

When do I need to call Control.Invoke? I understand this is required for
control method calls... but how about properties? Can I safely assign
properties from a separate thread without using .invoke?

Thanks.
 
I have an application which has a thread that raises events. The event
handler updates the UI.

When do I need to call Control.Invoke? I understand this is required for
control method calls... but how about properties? Can I safely assign
properties from a separate thread without using .invoke?

As adding to answer by Tim:
MSDN in most cases states what methods are thread-safe and what are not. In
Windows.Forms, [almost] all controls have thread-safe
BeginInvoke()/EndInvoke()/Invoke() methods and InvokeRequired property only.
Properties are in fact usual get_/set_ methods, just a syntantic sugar;
usual rules are used.
 
Back
Top