c# - Getting Data from Form Control in Thread -


having issue getting data form control within thread. need access data, modify it.

the following doesn't work i'm aware, used example see i'm trying do.

thread t = new thread(() => {     foreach (listviewitem row in listview1.items)     {         row.subitems[0].text = "checking";         thread.sleep(2000);     }   });  t.start(); 

i've read msdn documentation on making thread safe calls, can't seem access actual list view control. examples i've seen use delegates "update" controls, need access data in controls before update data in them.

edit:

i'd see example, or link example, detailing how access listview1 form control in foreach loop.

you need use invoke pattern, in order able access any ui element or properties thread other main ui thread. ui controls on windows allways run on main thread, handle message chain correctly between os , ui presented on screen.


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -