Solved

Reading text file only reading last line

Posted on 2006-06-21
4
250 Views
Last Modified: 2010-04-07
For some reason im trying to read a text file with about 50 lines and it keeps only reading the last line???

    Dim sData As String
    Dim sinputline As String
    Dim ff As Integer
    ff = FreeFile
    sData = Empty

    Open sUpdateScriptSys For Input As #ff
        Seek #1, 1
        Do While Not EOF(ff)
            Line Input #ff, sinputline
            sData = sinputline
            DoEvents
        Loop
    Close #ff
0
Comment
Question by:thaburner
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
fruhj earned 200 total points
ID: 16955844
simple
Sdata = sinputline
should be
SData = SData + sInputline
0
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 16955848
No, it's reading every line... you are just overwriting it each iteration of the loop.

What exactly are you trying to do - because the code you shown is just reading in the line and moving to the next line and not doing anything.
0
 

Author Comment

by:thaburner
ID: 16955858
lol now i feel stupid i dont know what i was thinking. lol thx
0
 
LVL 12

Expert Comment

by:fruhj
ID: 16955863
been there and done that so don't feel bad.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

910 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now