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 / .NET Framework / New Users / October 2007

Tip: Looking for answers? Try searching our database.

BindingSource and currency management event question...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jamie Risk - 25 Jul 2007 18:36 GMT
I have several 'generations' of parent-child DataTable
relations in my code, and was wondering how best to improve
(fix) the following.

When navigating through a parent table, I wan't to automatically
update the child tables filters and displays.  I've done this
through the DataTable's BindingSource.CurrencyManager
PositionChanged event.  Within the event handler, I call out to
child table delegate and to do the following.

    this.bindingSource.Filter = string.Format("{0} = {1}",
                         idParentColumnName, idParentValue);
    this.bindingSource.MoveLast();
    this.bindingSource.MoveFirst();

I have found however, that in order to propogate the filter
updates through several 'generations' of parent-child relations,
I need to call to programmatically change the position being
displayed.  Unless there is only one record in the DataTable,
this code succesfully triggers the PositionChange event for
child table.

Is there a more clever way of doing this?

- Jamie
Rick Mogstad - 15 Aug 2007 18:46 GMT
Using the CurrentChanged event.

>I have several 'generations' of parent-child DataTable
> relations in my code, and was wondering how best to improve
[quoted text clipped - 21 lines]
>
> - Jamie
SteveKing - 10 Oct 2007 15:35 GMT
If the tables have a parent-child relationship established with a foreign key
modeled in a single DataSet then there is no need for filters.  Merely create
another BindingSource as set the DataSource to the parent's BindingSource and
the DataMember to the foreign key.  

          ' Parent BindingSource
           With bsComp
               .DataSource = aideDS
               .DataMember = "tblPprComponents"
           End With

          ' Child BindingSource
           With bsCompLinks
               .DataSource = bsComp
               .DataMember = "FK_tblPprComponents_tblPpr_PprComp_Links"
           End With

> I have several 'generations' of parent-child DataTable
> relations in my code, and was wondering how best to improve
[quoted text clipped - 21 lines]
>
> - Jamie

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.