I'm using the following code to read down to the third line of a text file. If it meets the criteria, I need to stop the read and then delete the file. However I'm finding it difficult to do this as everything I've tried has failed. Have you some thoughts on how I can do this?
Do While objReader.Peek() <> -1 txtLine = objReader.ReadLine() programName = Trim(Microsoft.VisualBasic.Left(txtLine, 14)) If lineNo = 3 And programName = "(avl.allover)" Then fileSave = hotelFolder & "\Daily Reports\" & propertyNo & "Allover.txt" System.IO.File.Copy(fileName, fileSave, True) ' Stop the reading of the file and delete the file now. But how? Exit Do End If
In advance, thanks for your help.