public void test(string str)
{
    // 생성된 스레드가 아닌 다른 스레드에서 호출 -> true, 정상 -> false
    if (this.InvokeRequired)
    {
        this.Invoke(new MethodInvoker(delegate ()
        {
            label1.Text = str;
        }));
    }
    else
    {
        label1.Text = str;
    }
}

 

'Programming > C#' 카테고리의 다른 글

c# ListView 추가한 아이템 포커스  (0) 2020.01.29
c# ping test  (0) 2020.01.29
monodevelop Mysql  (0) 2020.01.29
C# ListView 선택된 아이템 가져오기  (0) 2020.01.29
c# Mysql  (0) 2020.01.29

+ Recent posts