2

私は約 3 時間見回しており、この呼び出しを機能させることができません。それを呼び出すものは別のスレッドにあり、不安定であると言っているので、呼び出しが必要です。

これが私が呼んでいるものです(私はこのように呼んでいますtextBox1_TextChanged(null, null);):

 private void textBox1_TextChanged(object sender, EventArgs e)
 {
     if(this.InvokeRequired)
     {
        this.Invoke(this?WHAT GOES HERE, null); // I know it should be a delegate or something but I can't change this to that
     }
     else
     {
        string temp = ""; 
        temp += TextToAdd;
        textBox1.Text = "s";
     }
}
4

1 に答える 1

2

BeginInvokeを使用して、他のスレッドから UI を更新できます。

if (this.InvokeRequired)
{
  var action = new Action(() => textBox1.Text = "s");
  this.BeginInvoke(action);
}
于 2016-01-28T07:16:28.113 に答える