相关疑难解决方法(0)

跨线程操作无效

可能重复:
跨线程操作无效:从创建它的线程以外的线程访问控件

好的,我知道为什么这会给我这个错误:

跨线程操作无效:控制从其创建的线程以外的线程访问的"Form1".

但是......我怎样才能使这个可行?

System.Threading.Thread t = new System.Threading.Thread(()=>
{
   // do really hard work and then...
   listView1.Items.Add(lots of items);
   lots more UI work
});
t.Start();
Run Code Online (Sandbox Code Playgroud)

我不关心Thread何时或如何完成,所以我并不关心任何花哨或过于复杂的atm,除非在新的Thread中使用UI时会更容易.

.net c# user-interface multithreading winforms

30
推荐指数
2
解决办法
4万
查看次数

标签 统计

.net ×1

c# ×1

multithreading ×1

user-interface ×1

winforms ×1