467,894 Members | 1,462 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,894 developers. It's quick & easy.

Many objects updating listview

Hi,
I've got a number of objects that each have it's own thread. When the value
changes I raise an event. Now, I want to handle the event in a form and show
the value in a listview.
With my first approach I had to have a synclock on the listview the whole
event handler, after some reading I've understood that updating a control
from different threads should use the controls Invoke statement.
Should I use it as well? It's not the individual thread that is updating the
control, at least that's what the major part of me is voting for ;)

TIA
/Kejpa
Nov 21 '05 #1
  • viewed: 1056
Share:
2 Replies
Kejpa,

Try to upgrade your listview from one place (the mainthread) giving the
information through events to that from the subthreads, than you need no
synclock at all.

However use the standard method to catch that event from threads for that.

See for that the walkthrough authorising a multithreading application. It is
a terrible written sample because of the names of fields and methods they
have used, however it shows in the bottom very well how to handle an event
in a multithreading situation.

http://msdn.microsoft.com/library/de...dcomponent.asp

I hope this helps?

Cor

"Kejpa" <kS*******@saj.fi>
Hi,
I've got a number of objects that each have it's own thread. When the
value
changes I raise an event. Now, I want to handle the event in a form and
show
the value in a listview.
With my first approach I had to have a synclock on the listview the whole
event handler, after some reading I've understood that updating a control
from different threads should use the controls Invoke statement.
Should I use it as well? It's not the individual thread that is updating
the
control, at least that's what the major part of me is voting for ;)

TIA
/Kejpa

Nov 21 '05 #2
As usual Cor,
good point and I'm on my way <hiyaaa!>

;)
Kejpa
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

11 posts views Thread by thechaosengine | last post: by
2 posts views Thread by Greg | last post: by
reply views Thread by willow1480 | last post: by
2 posts views Thread by thorgal | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.