I will suggest you use LINQ coding which let’s you instantly filter a table on criteria.
This is how I would do it:
table1.AsEnumerable.Where(Function(r) not table2.AsEnumerable.Select(Function(r2) r2(0).ToString.Trim.ToUpper).ToArray.Any(Function(x) x=r(0).ToString.Trim.ToUpper) ).CopyToDataTable
What I am doing in that code is, creating an array of the items in table2 with allowed names, and using .Any() to check the array and compare the values in table1. The .Where() goes through each item in table1, using that comparison, then .CopyToDataTable to create a new table. I added “not” infront of the comparison so it takes rows that are not contained in table2’s array of items. (also, I used .ToUpper so the tables don’t require certain case on the letters.)
I hope that is clear.
Disclaimer: I did not test the LINQ and am going from memory, so sorry for any mistakes.
There are other ways to accomplish this with loops too, like a combination of LINQ and ForEach/IF or a ForEach/IF embedded in a ForEach, but sometimes it all clutters your code and is slower.