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 / October 2006

Tip: Looking for answers? Try searching our database.

BindingSource and RaiseListChangedEvents

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark Atkinson - 27 Oct 2006 16:53 GMT
I'm trying to bind my winform controls to a BindingSource instead of a
DataView and I'm setting the DataView as the BindingSource's DataSource
property.
My main reason for binding to the Bindingsource instead of the DataView
directly is to take advantage of the RaiseListChangedEvents boolean property
in the BindingSource.
Then I have code that (in summary) looks like this:
// start of code
bindingSource.RaiseListChangedEvents = false;

//  do stuff like merging data into underlying dataset
// set filters on dataviews, etc

bindingSource.RaiseListChangedEvents = true;
bindingSource.ResetBindings (false);
// end of code

When I'm "doing stuff" to the underlying data, I'm noticing that ListChange
events are still firing. I have hooked up the ListChange events of the
DataViews that are the DataSource of the BindingSource objects earlier but I
would have thought that they'd be supressed. Is it only the BindingSource's
own ListChange that gets affected and not the underlying DataSource (in this
case a DataView)?
Bart Mermuys - 28 Oct 2006 12:20 GMT
Hi,

> I'm trying to bind my winform controls to a BindingSource instead of a
> DataView and I'm setting the DataView as the BindingSource's DataSource
[quoted text clipped - 24 lines]
> this
> case a DataView)?

Well, no it won't suppress the DataView ListChanged events.

- The CurrencyManager is still the list-manager, it provides the changed
events, current item and item property info for any Controls that are bound
to a list including those that are bound to a BindingSource.

- The BindingSource however owns a CurrencyManager so the Controls will use
that one. (BindingSource is ICurrencyManagerProvider)

- The BindingSource also wraps the DataSource and 'sits' between the
DataSource and the CurrencyManager. (BindingSource is IBindingList)

Since the BindingSource is in between, it can suppress the changed events
going from the DataSource to the CurrencyManager and Controls use the
CurrencyManager.

HTH,
Greetings

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.