views:

153

answers:

2
+1  Q: 

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.

A: 

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.

Darren Kopp
+3  A: 

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.

Will Dean
Having the View (or the presenter/controller) pull the data from the model based on a timer (and newData flags) made a significant optimization in one of my 'dashboard' type projects recently.
Doug L.