-1

I have a form in detail view with a binding navigator. When i click next, if there is a change, i get asked if I want to save it. So if I know I didnt change anything and the rowstate is still coming up modified, how can i determine what was modified.

I get the row that was modified with dim changetable as datatable = table.getchanges(datarowstate.modified). I am getting 1 row as i suspect, it is the correct row bc it is the same as the current row i am on. So, how can I determine what exactly changed in that row. I can't seem to find what changed.

Thank you for the help.

braX
  • 11,506
  • 5
  • 20
  • 33
dk96m
  • 301
  • 3
  • 18
  • You can subscribe to events for the DataTable, ColumnChanged should do the trick. See my MSDN basic code sample. https://code.msdn.microsoft.com/Working-with-DataTable-2ff5f158?redir=0 – Karen Payne Mar 16 '18 at 18:39
  • I am trying to implement your code in a way. I tried setting bsdata to my bindingsource but then i get that datatable is not a member of 'DataTable' is not a member of 'System.Windows.Forms.BindingSource'. – dk96m Apr 10 '18 at 17:51
  • In regards to DataTable is not a member of BindingSource, there is a language extension method in the download under the folder CodeModules in LanguageExtensions.vb, include it and you will be fine. – Karen Payne Apr 11 '18 at 01:28

1 Answers1

1

Try this where the 1 is the column index. I just used a string, .ToString to test. Your column could be any type.

Dim row As DataRow = MyTable.Rows(0)
Dim x As String = (row(1, DataRowVersion.Original)).ToString
Debug.Print(x)
Mary
  • 14,926
  • 3
  • 18
  • 27
  • If i do DataRowVersion.Modified as well, will that show both and then i just need to find the column that has a difference? – dk96m Mar 16 '18 at 12:50
  • Perhaps a loop. Instead of hardcoding the 1, use a variable index. For index = 0 to MyTable.Columns.Count -1. then it would be If row(index, DataRowVersion.Current) Is row(index, DataRowVersion.Proposed) Then – Mary Mar 16 '18 at 13:44
  • I don't think .Modified is part of the enumeration. – Mary Mar 16 '18 at 13:44