Private Sub FilterFaster(ByRef tbl As DataTable)
Dim copyTable As DataTable = tbl.Copy
For Each r As DataRow In copyTable.Rows
Dim foundOne As Boolean = False
For i As Integer = (tbl.Rows.Count - 1) To 0 Step -1
If CompareRows(r, tbl.Rows(i)) Then
If foundOne Then
' delete the row from the primary table
tbl.Rows(i).Delete()
Else
' this is the first instance of duplication, it is ok
foundOne = True
End If
End If
Next
Next
copyTable.Dispose()
end sub
Do more with
Premium Content
You need an Expert Office subscription to comment.Start Free Trial