tag:blogger.com,1999:blog-3661306318448165757.post5445911531057886570..comments2010-05-24T10:08:48.469-07:00Comments on My Experiments with Technologies: My Solution: Cross-thread operation not valid error while setting a value to control through propertyRamhttp://www.blogger.com/profile/04342393173047242065noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-3661306318448165757.post-81122138186889439892010-05-24T10:08:48.469-07:002010-05-24T10:08:48.469-07:00Better solution:
public static void Invoke(this C...Better solution:<br /><br />public static void Invoke(this Control me, Action invoker)<br />{<br /> if (me.InvokeRequired)<br /> {<br /> me.Invoke(invoker);<br /> }<br /> else<br /> {<br /> invoker();<br /> }<br />}<br /><br />Then:<br /><br />textBox.Invoke(() => textBox.Text = _number.ToString());<br /><br />Full intellisense, much less scaffolding code, no reflection (and thus faster), Domenic Denicolahttps://www.blogger.com/profile/04000104124838953181noreply@blogger.com