I created a table, created a dataview, and sorted the dataview. I then populated the table with three rows of data and all was good. I then changed one of the fields (Hours) in one of the rows which SHOULD HAVE caused it to re-sort, but it did not re-sort. It seems to only affect the last row of the dataview. I tried removing and re-applying the sort condition with no luck. Any idea what is up here?
Function CreateStoreHours() As DataTable
StoreHours.Columns.Add("Store", GetType(String))
StoreHours.Columns.Add("Hours", GetType(Double))
StoreHours.DefaultView.Sort = "Hours ASC"
dgvStoresHours.DataSource = StoreHours
End Function
'Here I popluated the grid with three records. All were sorted correctly.
For v = 0 To StoreHours.DefaultView.Count - 1
If row("Store") = StoreHours.DefaultView(v).Item("Store") Then
Match = True
StoreHours.DefaultView(v).Item("Hours") = StoreHours.DefaultView(v).Item("Hours") + row("Hours")
'The Hours field gets adjusted properly, but it gets moved to the last record even
' though it should be sorted as the second record of three. This is also where I tried
' the un-sort and re-sort with no luck.
Exit For
End If
Next