I have a quite complex windows form with a tabbed representation of a grandParent>Parent>Child dataset using a Strongly typed Dataset and bindingsource components.
Going down the hirearchy works a treat using bindngsource; my problem is that i have multiple 'parallel' views of some of the data (eg the 1st tab is a summary view of open jobs, other tabs show parent and children views of this data) as well as 'lookup' drop downs. All of which I am attempting to keep in sync, so that changing a grandchild record would update the parent bindingsources, as well sync the lookup drop downs.
I am struggling to get this to work properly; I have form level properties holding the current job and routines that sync the form eg:
on bindingsource.positionchanged:
SetCurrentDetailJob(Me.PKSitesJobsBindingSource)
which is:
Private Sub SetCurrentJob(ByVal JobBindingSource As BindingSource)
If JobBindingSource.Position > -1 Then
_CurrentJob = CType(CType(JobBindingSource.Current, DataRowView).Row, ARCallDataSet.JobsRow)
_CurrentSite = _CurrentJob.GetParentRow("PK_Sites_Jobs")
_CurrentCompany = _CurrentSite.GetParentRow("PK_Company_Sites")
End If
and then a sync form routine that does this type of thing:
CompanyBindingSource.Position = CompanyBindingSource.Find("companyid", drsite.CompanyID)
I can never seem to totally get avoid some sort of chain reaction whereby bindingsource position changed events trigger multiple times resulting in inconsistencies with bindingsources not correctly synced. im not sure the best way to handle this syncing logic.
How do other people approach this?