-
Reverse the Text File
Dear All
When I append new record to the text file it saves the Record to the end of the file.
is there any way that I could save new Record to the beginning of the file. Basically the latest Record will be at the beginning of the text File.
Many Thanks for any Help or Advise
salih
-
Without knowing which objects/methods you are using to write your text file (that would help if you gave that), here is one simple way:
1) Stick the contents of your text file into a textbox
2) Move the textbox's insertion point to the beginning (selectionstart = 0)
3) Add your record
4) Write the contents of the textbox to the text file.
There is probably a much better way to do this depending on which object you are using (for example if you are using FileStream you can set .Position to 0 to move the "insertion point" to the beginning of the file, but if you are using StreamReader that won't work)