Matthias Meid
Matthias Meid

Reputation: 12513

BindingSource CurrentChanged/PositionChanged old item

Is there a way to get a notification before Current of a BindingSource changes in Windows Forms, including the old item?

I'd like to save the old element before navigating away. CurrentChanged and PositionChanges both are EventHandler events and do not provide a reference to the old item.

It is not that important to get notified before the position changes, but it is critical to get the old item.

Cheers Matthias

Upvotes: 1

Views: 4858

Answers (1)

DarkSquirrel42
DarkSquirrel42

Reputation: 10257

store it yourself ...

everytime Current changes you are notified by the event...

if you have a reference that is updated at the end of your eventhandler (store reference to current item) you can look at this reference when the event handler runs again ... when you look at it before it is updated, it will refer to the old item

Upvotes: 4

Related Questions