What is this advantage?
-
here I have wriiten some code from my application. I j't want to know what is the advantage of this invoke method,..'coz i joined this application partially and that is almost done.If you guys know about this and eny comments plese send me.... switch (_amxStr.Trim()) { case "DON": this.Invoke((System.Threading.ThreadStart)delegate() { showDND(); strAMX = ""; frmMain.AMX_String = ""; }); break; case "DOF": this.Invoke((System.Threading.ThreadStart)delegate() { hideDND(); strAMX = ""; frmMain.AMX_String = ""; }); break; }
-
here I have wriiten some code from my application. I j't want to know what is the advantage of this invoke method,..'coz i joined this application partially and that is almost done.If you guys know about this and eny comments plese send me.... switch (_amxStr.Trim()) { case "DON": this.Invoke((System.Threading.ThreadStart)delegate() { showDND(); strAMX = ""; frmMain.AMX_String = ""; }); break; case "DOF": this.Invoke((System.Threading.ThreadStart)delegate() { hideDND(); strAMX = ""; frmMain.AMX_String = ""; }); break; }
Take a look at www.codeproject.com/KB/cpp/begininvoke.aspx[^]. The short story is that you can't directly access UI elements from any random thread, only from the thread that created the element. To update the UI from a different thread, you "marshal" the delegate to the UI thread.
Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | My Flickr | WinMacro