Binding Navigator Refresh Items

  • Thread starter Thread starter Vayse
  • Start date Start date
V

Vayse

The idea being that when a new asset is displayed, the program would
recalculate the values of some labels.
For example, when Previous or Next is clicked.
I set bLoaded=True when the form loads, as otherwise the code would once for
each asset in the database when the form was loading -
Me.AssetsTableAdapter.FillByAsset(Me.AssetsDataSet.Assets, stAssetCode)

Another problem is that when the Save is done, the RefreshItems runs twice
for each of these lines
Me.AssetsBindingSource.EndEdit()
Me.AssetsTableAdapter.Update(Me.AssetsDataSet.Assets)

And heres my code:

Private Sub AssetsBindingNavigator_RefreshItems(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
AssetsBindingNavigator.RefreshItems

If bLoaded Then
TidyNumbers()
bNewSchedule = False
DoCalcFields()
End If

End Sub

Should I be putting this code somewhere else? How often does
BindingNavigator_RefreshItems run?

Thanks
Vayse
 
Hi,

Vayse said:
The idea being that when a new asset is displayed, the program would
recalculate the values of some labels.
For example, when Previous or Next is clicked.
I set bLoaded=True when the form loads, as otherwise the code would once
for each asset in the database when the form was loading -
Me.AssetsTableAdapter.FillByAsset(Me.AssetsDataSet.Assets, stAssetCode)

Another problem is that when the Save is done, the RefreshItems runs twice
for each of these lines
Me.AssetsBindingSource.EndEdit()
Me.AssetsTableAdapter.Update(Me.AssetsDataSet.Assets)

And heres my code:

Private Sub AssetsBindingNavigator_RefreshItems(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
AssetsBindingNavigator.RefreshItems

If bLoaded Then
TidyNumbers()
bNewSchedule = False
DoCalcFields()
End If

End Sub

Should I be putting this code somewhere else? How often does
BindingNavigator_RefreshItems run?

Can't you use AssetsBindingSource.PositionChanged event instead or does this
cause problems too ?

HTH,
Greetings
 
Bart Mermuys said:
Can't you use AssetsBindingSource.PositionChanged event instead or does
this cause problems too ?
That makes it work much better, thank you.
 
Back
Top