I want to make a single event that will capture every change in the data in a DataGridView
. The list of events is pretty long. I was thinking I could bind the DataGridView
to a DataTable
since it has less events and it gets notified whenever the user changes the data in the DataGridView
. Since the amount of data is tiny (2 columns and about 5 rows) but the user should be able to add, remove and edit rows, it would be a lot simpler if I put all possible changes in a single event so every other class that needs it gets notified when anything changes in the DataGridView
's data by handing a single event. I don't want to capture when the user is typing in a cell or when a row is resized or anything that won't be normally considered as representing a change in the data. That's also why I think using a binded DataTable
is a good idea. So my question is, which set of events is the minimum I need to handle in order to capture every possible 开发者_StackOverflowchange in the data contained in a DataGridView
or in a DataTable
(preferably a DataTable
I think)?
I would try to bind to the following DataTable events:
- RowDeleted
- RowChanged
Those should give you what you want - notification only in case you edit, delete or add a row.
精彩评论