form1 f2 = new form1 (); MethodInvoker method = new MethodInvoker(delegate() { f2.Name = "xyz"; f2.Text = "xyz"; 2.Tag = "xyz"; f2.Show(); }); if (f2.InvokeRequired)//if true then we are not on the control thread { f2.Invoke(method);//use invoke to handle execution of this delegate in main thread } else { method();//execute the operation directly because we are on the control thread. }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)