Click here to Skip to main content
15,900,589 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to read next line / previous line in a text file by keys.xx events using filestream pls

when i press p it should get previous line and for N it should get next line.

Thanks in advance
Improve solution Permalink
Posted 1 sec ago
Kornfeld Eliyahu Peter 18-Mar-15 10:12am    

1 solution

There is no "reading the previous line" of a text file. Reading the text file is pretty much a forward-only operation.

The easiest way to do it is to read the entire file into an array. Each line in the file will be one entry in the array. Then you simply navigate through the array line by line using your keys.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900