Threads and UI Control - Invoke?

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.
 
A

Alexander Ogol

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top