How to access a form-control from System.Timers.Timer (cross thread problem)

后端 未结 3 2015
离开以前
离开以前 2020-12-22 04:46

I use the system.timers.timer for my service.

Now I build a test-form in which I use it too. In the timer_Elapsed Event I do some work and want to stop the timer it

3条回答
  •  梦毁少年i
    2020-12-22 05:15

    If you want to acces a control from a thread other than the main UI thread, you need to use the Invoke method on the control you want to access.

提交回复
热议问题