Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top