线程,
private void SetValue() { int a = 0; for(int i=0;i<2000;i++) { a += i; } if(textBox1.InvokeRequired) { textBox1.Invoke(new Action<string, TextBox>(Value), a.ToString(), textBox1); } } private void Value(string s,TextBox txt) { txt.Text = s; }
private void SetValue() { int a = 0; for(int i=0;i<2000;i++) { a += i; } if(textBox1.InvokeRequired) { textBox1.Invoke(new Action<string, TextBox>(Value), a.ToString(), textBox1); } } private void Value(string s,TextBox txt) { txt.Text = s; }