I am trying to remove lines of text from a text file, the lines of text containn the word “invalid”. I am using the (InStr) that finds the lines of text but how do I remove these lines of text from the array
Here is what I have so far.
Thanks
Here is what I have so far.
Code:
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
Dim arrLines() As String = File.ReadAllLines("C:\test1.txt")
For j As Integer = 0 To arrLines.Length - 1
lineIn = arrLines(j)
If InStr(lineIn, "invalid") Then
'Remove the line of text from the array
End If
Next
File.WriteAllLines("C:\test1.txt ", arrLines)
End Sub
Thanks