C# - Schnelles Update von Threads und UI

private void button1_Click(object sender, EventArgs e)
{
    Thread t = new Thread(new ThreadStart(RunThread));
    t.Start();
}

public void RunThread()
{
    MyMethod2("Bier");
}


private void MyMethod2(string mystring)
{
    label1.Invoke((MethodInvoker)delegate {
        label1.Text = mystring;
    });
}

  • Csharp
  • Threads
  • GUI

Werbung



comments powered by Disqus

Copyright Dunkel & Iwer GbR | Datenschutzerklärung | Impressum