is it possible to read previous line in a text document?

my text file works like a database except it can't be sorted. but i read each line when i click a "next" button using:


is there a way to go back a line when i click on a "previous" button?

Jeremy DaleySenior DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Most likely you have opened the file in sequential mode and cannot do that.  You can open the file in Random mode, but this requires that the data be written to it as records with predefined fields lengths, etc....

Alternatively, your could close the file, reopen it, and then count down to the line just before your previous location.
Anthony PerkinsCommented:
A WAG, but perhaps you can use the Skip method with negative characters.  Of course that would assume you kept tabs as to where you were and the length of the last/previous line(s)

Jeremy DaleySenior DeveloperAuthor Commented:
i'll have to cancel this question if i don't find an obvious way cause i just figured a way out using an array:

   dim myarray() as string, n
   myarray=split(thefile.ReadAll, vbNewLine)
   'myarray(n) is the first i only need to add and subtract from "n"

thanks anyway,
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Anthony PerkinsCommented:
No problem.

Anthony PerkinsCommented:
Need some help getting this question deleted and your 25 points refunded?

I answered my question myself. What do I do?

Mike TomlinsonHigh School Computer Science, Computer Applications, and Mathematics TeachersCommented:
Refund is his points as he figured out a way himself.

PAQ'd and 25 points refunded.


Community Support Moderator
Experts Exchange

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.