Infragistics
Infragistics sample of how to synch a grid and form detail only works if the grid is not allowed to be sorted. Instead of using the grid's row position. The record position of the underlying binding source should be used.
ugGradingLocation - is the Infragistics grid
ScopingScenarioTypicalGradingSecBindingSource - is the binding source for the grid and form detail.
Sub GridSynchWithForm()
' Use CurrencyManager to set position (this will handle sorted grids)
If Me.ugGradingLocation.ActiveRow IsNot Nothing Then
Dim cmGrid As CurrencyManager = DirectCast(BindingContext(ugGradingLocation.DataSource, Me.ugGradingLocation.DataMember),
_ CurrencyManager)
Dim cmForm As CurrencyManager = Me.BindingContext(Me.ScopingScenarioTypicalGradingSecBindingSource)
If cmForm.IsBindingSuspended Then
cmForm.ResumeBinding()
End If
cmForm.Position = cmGrid.Position
'If the grid could not be synched with the from detail
'Assume the grid is adding a row and temporary suspend binding.
If cmForm.Position <> cmGrid.Position Then
cmForm.SuspendBinding()
End If
End If
End Sub
Called when the following events occur:
ugGradingLocation_AfterRowActivate
ugGradingLocation_AfterRowInsert
ugGradingLocation_AfterRowUpdate
No comments:
Post a Comment