'Using a BindingSource, how do I tell if I have changes pending?

I am using a BindingSource in a WinForms project that edits a simple table on a SQL server. I want the "Save" icon to light up when the user tabs off a field if he has changed it. I have tried the HasChanges() method of the DataSet, but this returns false after I have made a change.

How do I tell if the user has changed something?



Solution 1:[1]

My problem was that I needed to call EndEdit() from the BindingComplete event. After doing that, HasChanges() (as well as Pete's RowState suggestion) worked.

Solution 2:[2]

After calling endedit, you need to check RowState.

hope this will help you.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jon B
Solution 2