My Timer event crashes because the events are called on a different thread

前端 未结 8 1669
再見小時候
再見小時候 2021-01-21 10:49

I get the error \"Cross-thread operation not valid: Control \'label1\' accessed from a thread other than the thread it was created on.\" when I run this code:

us         


        
8条回答
  •  清歌不尽
    2021-01-21 11:31

    Are you remembering to use InvokeRequired? It will allow you to update a UI element on the UI thread from the Timer thread.

提交回复
热议问题