473,399 Members | 4,192 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,399 software developers and data experts.

Thread problem with BindingList<T>

Hi,

To be able to show my objects in a Grid, I've inherited my list
implementation from BindingList<T>.

The problem is that de objects in this list are created/changed/deleted
in different threads.
If I link the BindingList<T> implementation to a grid
(grdNodes.DataSource = Nodes.List), I get a thread exception when I try
to add a new object using a worker thread.

I know this is because the ListChanged event isn't synchronized, but
isn't this an error/bug in the bindinglist or DataGrid !
Shouldn't one of them synchronize the event ???
Kind regards
Frank Vanderlinden

Nov 21 '05 #1
3 5419
Frank VDL wrote:
To be able to show my objects in a Grid, I've inherited my list
implementation from BindingList<T>.

The problem is that de objects in this list are created/changed/deleted
in different threads.
If I link the BindingList<T> implementation to a grid
(grdNodes.DataSource = Nodes.List), I get a thread exception when I try
to add a new object using a worker thread.

I know this is because the ListChanged event isn't synchronized, but
isn't this an error/bug in the bindinglist or DataGrid !
Shouldn't one of them synchronize the event ???


Do any of the classes involved claim to be thread-safe? If not, I don't
see that it's a bug.
You should be changing the data model *only* on the UI thread, if a UI
control is bound to it.

Jon

Nov 21 '05 #2
"You should be changing the data model *only* on the UI thread, if a UI

control is bound to it. "

I agree, but I can't change how the datagridview handles the
ListChanged event.
Doesn't it has to sync it's ouwn events with the UI thread ?

Nov 23 '05 #3
Frank VDL wrote:
"You should be changing the data model *only* on the UI thread, if a UI
control is bound to it. "

I agree, but I can't change how the datagridview handles the
ListChanged event.
Doesn't it has to sync it's ouwn events with the UI thread ?


No. The point is that if you only change the list on the UI thread, all
will be well. That's your responsibility, not the control's.

Jon

Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
4
by: PASQUALE | last post by:
Hi I have a question: do the both statements below give the same result? If yes then does somebody know something about preformance differencies using these joins? SELECT A.* FROM Table1 A...
29
by: John Rivers | last post by:
Hello, What good reason there is for not allowing methods in ASPX pages I can't imagine, but here is how to get around that limitation: (START) <body MS_POSITIONING="FlowLayout"> <form...
1
by: James | last post by:
I would like to call a method of my code from within XSL but it does not seem to like the presence of the '%' character inside the xsl. Basicly the XSL loops through an XML writing url's into...
1
by: rdemyan via AccessMonster.com | last post by:
I have the following SQL statement in code: strSQL = "SELECT * FROM TABLEA WHERE F2 = 'SITE' This returns the record that I expect. However: the following does not strSQL = "SELECT *...
4
by: Michel Walsh | last post by:
Hi, A datagrid has its DataSource set to a BindingList<CustomClass>. While the ListChanged event fires AFTER a deletion, I am looking for a simple way to be notified BEFORE the item would be...
8
by: vunet.us | last post by:
I create an ASP file using fso.createtextfile. But how do I avoid double quotes and <% %signs when writing to file? FileAsp.WriteLine("<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252">")...
4
by: saneman | last post by:
I have a folder 'app' containing a file 'main.cpp' and a subfolder 'types' (containing various header files). In main.cpp some header files from the subdir 'types' are included like: 1)...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.