反向遍历
Dim p As Integer = Tables(e.DataTable.Name).FindRow(e.DataRow)
If p > 0 Then
Dim v = Tables(e.DataTable.Name).Rows(p-1)("第一列")
Dim indexb = Tables("表B").Rows.Count - 1
If Tables("表B").Rows(indexb)("第一列") = v Then
Tables("表B").Rows.AddNew()
End If
For idxb As Integer = indexb-1 To 0 Step -1
If Tables("表B").Rows(idxb)("第一列") = v Then
Tables("表B").Position = idxb + 1
Tables("表B").Rows.InsertNew()
End If
Next
End If