Solved

Reading text file only reading last line

Posted on 2006-06-21
4
256 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
[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
  • 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 96

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…

717 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