delete text file line

asish

Member
Joined
Jan 17, 2008
Messages
20
Programming Experience
Beginner
hi, i need to load a text file and then delete the 4th line in the text file ... wanted to knw if this was possible:confused:..thank u in advance
 
It's not possible to delete a line of a file. You need to read the file in, make whatever edits you require, then write the new contents back out again. IO.File.ReadAllLines will create a String array. You can add the contents of the array to a List(Of String). You can then Remove an item from that collection. The ToArray method will convert back to an array, then you can use IO.File.WriteAllLines to write the result to the file again.
 
Back
Top