Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / November 2004

Tip: Looking for answers? Try searching our database.

How to update an IBindingList in a separate thread?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Julien Sellgren - 09 Nov 2004 23:49 GMT
I have a DataGrid bound to a custom collection that implements
IBindingList. It is well known that updates to windows forms widgets
must be done on the same thread as the form. Here is the kicker: I
would like to have a process in a separate thread that makes updates
to the collection. Ideally what I would like is for the DataGrid to
call Invoke() when it receives the ListChanged event, before updating
itself. Is there a correct way to do this?

I have worked around this issue by implementing my collection as a
derivative of IList, instead of IBindingList so that updates to the
list in a separate thread don't cause a refresh on the DataGrid. What
I do then, is implement a custom ListChanged event on my collection,
and I wrap the DataGrid in a separate component that listens for the
event - calling DataGrid.Refresh() through an Invoke.

This works great, however, the 'whole' Data grid gets refreshed every
time a single row changes, which causes a bit of flicker.

Any thoughts on how to properly update an IBindingList in a separate
thread? This seems like an obvious thing to need to do...

Cheers,

- Julien
Julien Sellgren - 10 Nov 2004 22:02 GMT
I suppose another solution would be to fire the ListChanged event
using control.Invoke() from within the collection. This would mean
that the collection would need to be 'aware' of the datagrid however,
which I am not keen on. Any other thoughts on this issue?

- Julien

> I have a DataGrid bound to a custom collection that implements
> IBindingList. It is well known that updates to windows forms widgets
[quoted text clipped - 20 lines]
>
> - Julien

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.