I got the below code when tried its giving me out of memory error in the application , could you please suggest what is wrong with this code.
Dim lines As New List(Of String)(IO.File.ReadAllLines("O:\ReportAll.txt"))
'Remove the line to delete, e.g.
'lines.RemoveAt(0)
lines.RemoveRange(0, 9)
IO.File.WriteAllLines("O:\ReportAll_new.txt", lines.ToArray())
solutionsdxb
Member
76 Points
131 Posts
Re: how to delete few lines from the text file either with line number or with content
Mar 31, 2009 06:52 PM|LINK
hi thanks for your reply,
I got the below code when tried its giving me out of memory error in the application , could you please suggest what is wrong with this code.
Dim lines As New List(Of String)(IO.File.ReadAllLines("O:\ReportAll.txt")) 'Remove the line to delete, e.g. 'lines.RemoveAt(0) lines.RemoveRange(0, 9) IO.File.WriteAllLines("O:\ReportAll_new.txt", lines.ToArray())