Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2003-10-27
8
Medium Priority
?
162 Views
Last Modified: 2010-05-01
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:

  thefile.Readline

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

thanks,
jeremy
0
Comment
Question by:Jeremy Daley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 9628541
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.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 9628709
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)

Anthony
0
 
LVL 4

Author Comment

by:Jeremy Daley
ID: 9628801
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
   n=0
   myarray=split(thefile.ReadAll, vbNewLine)
   
   'myarray(n) is the first line...now i only need to add and subtract from "n"

thanks anyway,
jeremy
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 9628891
No problem.

Anthony
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 9631260
Need some help getting this question deleted and your 25 points refunded?

I answered my question myself. What do I do?
http://www.experts-exchange.com/help/closing.jsp#4

Anthony
0
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 10164858
Refund is his points as he figured out a way himself.

Idle_Mind
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10167070
PAQ'd and 25 points refunded.

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question