Populating a listview from another thread

后端 未结 5 681
旧时难觅i
旧时难觅i 2021-01-21 21:01

I\'m trying to populate a listview from another class, but I\'m geting this error: \" Cross-thread operation not valid: Control \'listView1\' accessed from a thread other than t

5条回答
  •  天命终不由人
    2021-01-21 21:26

    You are trying to update the GUI thread from you background thread. You will need to use Invoke on the control you would like to update. You can check the InvokeRequired property on that control to see whether or not you will need to use Invoke to update the control

提交回复
热议问题