How to use multithreading with Winform?

前端 未结 9 1333
无人及你
无人及你 2020-12-17 16:27

I\'m a newbie with multithreading. I have a winform that have a label and a progress bar.

I wanna show the processing result. Firstly, I use Application.DoEven

9条回答
  •  感动是毒
    2020-12-17 16:55

    Invoke the UI thread. For example:

    void SetControlText(Control control, string text)
    {
        if (control.InvokeRequired)
            control.Invoke(SetControlText(control, text));
        else
            control.Text = text;
    }
    

提交回复
热议问题