473,395 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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
2 1240
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: thechaosengine | last post by:
Hi all, I have a very general but quite significant question about objects. My question is, when should I create them? I know thats a crap question so let me explain a bit further. Lets...
2
by: Greg | last post by:
I'm trying to display record information in labels, I've got a listview filled with records and when you click on one of them I want that record's information shown in several labels. This is how...
15
by: Wiktor Zychla | last post by:
today we've found a critical issue regarding the ListView from Windows.Forms. it was confirmed on several machines with Win2K and XP. here's the problem: create a ListView with about 50000 rows....
0
by: willow1480 | last post by:
I am developing a small little Service Control Application. I am using a listview control with checkboxes and getting the list of services I want to control from a text file. When you check a...
0
by: Art Guerra | last post by:
Any tips or information would be most appreciated! Here is my scenario simplified: I have a main application form (Form1) and on that form is a listView control. On a separate form (Form2), the...
5
by: Charles Law | last post by:
Some of the eagle-eyed amongst you will spot this as a direct follow on from my earlier post about critical timing in .NET. I want to use a ListView to display my output (instead of the sluggish...
2
by: thorgal | last post by:
Hello Following problem occured: I have an MdiParent with a Listview. In that listview i have elements like (x1,x2,x3) When I click on x1 a subform (mdichild) opens and i can change the...
2
by: Spam Catcher | last post by:
Hi All, I want to bind a datagridview or ListView to a List that is constantly being updated (items are added/removed all the time). Any ideas what the best way is to do this? I tried binding...
1
by: Enij | last post by:
Hi All, Long story short, I have created a ListView type control, using UserControls for the parent control and the ListViewItems. Most the of the control is written and works fine, right up to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.