using thread for listview update
-
in my app i've two threads , one for update the listview and one for main form,the problem is i used thread.sleep() method to update the listview,instead of using a timer periodically, but when this thread is strated in a while(true) loop,it doesn't allow the other thread to execute, how can i use the thread.sleep() to do fill th listview periodically
-
in my app i've two threads , one for update the listview and one for main form,the problem is i used thread.sleep() method to update the listview,instead of using a timer periodically, but when this thread is strated in a while(true) loop,it doesn't allow the other thread to execute, how can i use the thread.sleep() to do fill th listview periodically
The actual filling of a ListView should be done from the mainthread if I'm not mistaken. Doing this from another thread has no advantages, since the other thread needs to synchronize with the mainthread anyhow. You can use the second thread to fetch the items that go in the ListView, and you can use it to modify the resultset before inserting them into the ListView.
I are troll :)
-
in my app i've two threads , one for update the listview and one for main form,the problem is i used thread.sleep() method to update the listview,instead of using a timer periodically, but when this thread is strated in a while(true) loop,it doesn't allow the other thread to execute, how can i use the thread.sleep() to do fill th listview periodically
Do a search for 'InvokeRequired'. That should give you some clues.
Henry Minute If you open a can of worms, any viable solution *MUST* involve a larger can.
-
in my app i've two threads , one for update the listview and one for main form,the problem is i used thread.sleep() method to update the listview,instead of using a timer periodically, but when this thread is strated in a while(true) loop,it doesn't allow the other thread to execute, how can i use the thread.sleep() to do fill th listview periodically
Use a delegate to update the List items... Control.Invoke( delegate )..
Moim Hossain R&D Project Manager BlueCielo ECM Solutions BV
-
in my app i've two threads , one for update the listview and one for main form,the problem is i used thread.sleep() method to update the listview,instead of using a timer periodically, but when this thread is strated in a while(true) loop,it doesn't allow the other thread to execute, how can i use the thread.sleep() to do fill th listview periodically