I'm trying to remove the lines from a text file that contains a specific word using vb.net. I have this done using c#
c#
var oldLines = System.IO.File.ReadAllLines(TemporaryLBL);
var newLines = oldLines.Where(line => !line.Contains("$PhysicsNo#"));
System.IO.File.WriteAllLines(TemporaryLBL, newLines);
vb.net
Dim oldLines = System.IO.File.ReadAllLines(TemporaryLBL)
Dim newLines = oldLines.Where(Function(line) Return Not line.Contains("$PhysicsNo#") End Function)
System.IO.File.WriteAllLines(TemporaryLBL, newLines)
Not sure if this is the correct way to do it, so far I'm getting an error on the Function part: Expression expected.
Function(line) Not line.Contains("$PhysicsNo#"))should do it.