One of the features of this app I am making requires that I do this.
XML is not used and CANNOT be used.
I need to find a line in a text file and remove it.
The file has a structure like this:
jjb:/dkfhs/fjds.udi
jjb:/dkfhs/sjsk.udi
jjb:/sjaok/susk.udi
Say I want to remove a specified line of the text file so the result would make the text file look like this:
jjb:/dkfhs/fjds.udi
jjb:/sjaok/susk.udi
How would I do it?
I searched the forums and found this but it does not remove my specified line.
Please help, any of it is much appreciatedCode:Dim lines As New List(Of String) 'Read the entire file into a collection of lines. lines.AddRange(IO.File.ReadAllLines(Form1.Label7.Text)) For i As Integer = 0 To lines.Count - 1 If lines(i) = "jjb:/dkfhs/sjsk.udi" Then lines.Insert(i + 1, "") End If Next 'Write out the new file contents. IO.File.WriteAllLines(Form1.Label7.Text + "seplugins\vsh.txt", lines.ToArray())
Louix.






Reply With Quote