DataTable detect column changed using ColumnChanged event
15-Nov-1212 Leave a comment
Background
Because of disconnected nature of VB.Net databinding I have users who have come from MS Access instant save who in .Net are concerned that they fogot to press save. Hence I added CheckForChangesAndPromptForSave. However this is firing too much. I have too much code and something must be changing a column but need to detect which and probably stop changing it.
Solution
Open Dataset and select table with changes. View Code. This generates new code window if not present. On table event use the ColumnChanged event.
Partial Class dsBusiness Partial Class QuoteDataTable Private Sub QuoteDataTable_ColumnChanged(sender As Object, e As System.Data.DataColumnChangeEventArgs) Handles Me.ColumnChanged MsgBox(e.Column.ColumnName) End Sub End Class End Class