I think you'll want to do a loop with an exit point inside the loop. The exit point will fire just after the replacement takes place. Below is a function that I believe will do the trick...The 'WriteToNewFile' is the only code not provided (I can help with that too if necessary). The down side here is that you will end up going through the whole file every time, which I know you don't want to do. But once the line is found the 'ReadToEnd' goes really fast.
For example:
Main Topics
Browse All Topics





by: DhaestPosted on 2009-07-29 at 02:27:59ID: 24968408
I think that you'll read the file line by line, just to replace the correct line (in that case, you don't read it completely into the memory)
u/program/ windows/so a/Reading- and- writin g-text-fil es-with-VB -NET/0,339 024644,320 267367,00. htm
Reading and writing text files with VB.NET
http://www.builderau.com.a