Question on TextReader & TextWriter

flash.tato

Member
Joined
Aug 26, 2006
Messages
8
Programming Experience
Beginner
I have a file with this structure
VB.NET:
[B]4 81 xxx xxx xxx 0[/B]
[B]4 82 xxx xxx xxx 0[/B]
[B]4 83 xxx xxx xxx 0[/B]
[B]4 84 xxx xxx xxx 0[/B]

xxx xxx xxx are values that i don't know.

I want that clicking a button it search the line that it starts with "4 81" and edit xxx xxx xxx (in the same line) with "789 980 650"

How can I do?!
 
Last edited:
You don't edit text files. You read them into a String or Strings, edit those, then write the result back to the file. The easiest way would be to use the IO.File.ReadAllLines method to get an array of lines from the file. You can then perfrom whatever edits you need and call IO.File.WriteAllLines to write out the new text.
 
Back
Top