Cross-thread operation not valid in Windows Forms

前端 未结 7 1436
醉酒成梦
醉酒成梦 2020-12-11 17:52

Could anyone help me i have a problem I\'m trying to get this code to work in the background via threadpool but i cannot seem to get it to work i keep getting this error:

7条回答
  •  佛祖请我去吃肉
    2020-12-11 18:18

    I'm assuming that DoWork is launched on another thread. The code accesses ListBox3, which is a GUI control. .NET restricts access to GUI controls to the thread that created them.

提交回复
热议问题