Visit Object under Cross-Threading Env

来源:互联网 发布:mac 最新版 发布时间 编辑:程序博客网 时间:2024/06/07 07:08
        private void runThread()        {            GeneralFunction.WebService1SoapClient client = new GeneralFunction.WebService1SoapClient();            // get the 30th position of fabonacci number            DateTime start = DateTime.UtcNow;            long n30 = client.fabonacci(37);            DateTime end = DateTime.UtcNow;            TimeSpan duration = end.Subtract(start);            String output = "\n\rStart: " + start.ToString() +                             "\n\rEnd: " + end.ToString() +                             "\n\rRequest was dealt in: " + duration.TotalSeconds + " s";                                      textBox1.Invoke(new MethodInvoker(delegate                 {                    textBox1.Text += output;                }));        }


and if you want to enter a new line:

Environment.NewLine;"\r\n";(char)13 + (char)10; 



they should work.


原创粉丝点击