作者deuter (Harold)
看板C_Sharp
標題Re: [問題] form & thread的關係
時間Tue Nov 20 13:42:18 2007
※ 引述《chengchieh (chieh)》之銘言:
: 這兩天在想的內容又卡卡的~~
: 我目前有兩個project(稱為prj1,prj2好了~)
: 然後我的想法是..
: prj1為StartUp project.
: prj1 and prj2底下都各有一個form.(稱為form1,form2好了~)
: 目前打算要透過form1上面的button來新增thread去跑form2.
最好不要這樣做, 因為Control不是 thread-safe
除非你很小心 知道自己在做甚麼, 否則很容易跑出 expcetion
http://0rz.tw/c53hJ
if you are calling a control's method from a different thread,
you must use one of the control's invoke methods to marshal the
call to the proper thread
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 67.161.17.127
1F:推 chengchieh:嗯嗯..來去試試其他的作法^^ 11/20 13:59