joek1975
joek1975

Reputation: 3583

UI Thread Safety

Any suggestions on the best way to ensure thread safety when changing the properties on Form controls? I have been using Me. Invoke in the past, and I was wondering if you have pros/cons, comments, suggestions, etc.

Upvotes: 1

Views: 279

Answers (2)

Darren Kopp
Darren Kopp

Reputation: 77627

I do control. Invoke on the target control rather than the entire form, but that's just me. I claim no advanced knowledge of win forms, I just have to use it every now and then.

Upvotes: 0

Will Dean
Will Dean

Reputation: 39500

Invoke is the proper way to do it if you're pushing stuff at the form from another thread.

But you might consider whether the form might be better pulling data itself, perhaps from a timer, and perhaps less frequently than a background process might push individual updates.

Upvotes: 3

Related Questions