크로스 스레드 오류를 피하면서 어떻게 작성된 스레드 이외의 스레드에서 컨트롤에 액세스 할 수 있습니까? 여기 다른 스레드에서 컨트롤에 액세스하는 방법?
이 내 예제 코드입니다 :private void Form1_Load(object sender, EventArgs e)
{
Thread t = new Thread(foo);
t.Start();
}
private void foo()
{
this.Text = "Test";
}
이것에 대해 스택 오버플로에 대한 많은 질문이 있습니다이 방법을 리팩토링 할 수있다. – ChrisF
Winforms에 익숙하지 않다면 WPF로 시작하는 것이 좋습니다. 많은 사람들이 동의하지 않을 수 있지만 imho Winforms는 죽었습니다. WPF에서이 문제는 각 구성 요소에 대기열 작업으로 해결되었습니다. – Gilad
Dupe of http://stackoverflow.com/questions/142003/cross-thread-operation-not-valid-control-accessed-from-a-thread-other-than-the-t http://stackoverflow.com/ 질문/3650109/cross-thread-operation-not-valid-control-textbox1-accessible-any-help-plz http://stackoverflow.com/questions/1809864/how-to-access-a-form-control-from -system-timers-timer-thread-thread-problem – gideon