Results 1 to 2 of 2

Thread: Reverse the Text File

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2002
    Location
    ENGLAND
    Posts
    38

    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
    sa

  2. #2
    Fanatic Member
    Join Date
    Sep 2002
    Posts
    518
    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)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width