Results 1 to 4 of 4

Thread: [RESOLVED] Reading Text file

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Posts
    89

    Resolved [RESOLVED] Reading Text file

    Hey there guys, I have some source on reading a text file, but it just reads the top line only.

    so if:
    john had food
    today and he....

    it will only read "john had food"

    also I have code that can read a text file using spaces.

    so if:
    john had food

    my text boxs would say.
    1. jonh
    2. had
    3. food

    Now what I want to do is be able to read line by line.

    So if:
    john had food today
    john had food also yesterday

    then my text boxs must look like this:

    text box 1. "john had food today"
    text box 2. "john has food also yesterday"


    ALos i would really appritiat if you could give me the code to change the text file from VB. (Write to the text file)

    Thanks alot guys... I really really hope you can help out.

  2. #2
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: Reading Text file

    VB Code:
    1. Dim s As String
    2. Open "C:\MyFile.txt" For Input As #1
    3.  
    4. Do Until EOF(1)'read entire file
    5. Line Input #1, s 'read line in file
    6. Loop
    7.  
    8. Close #1

  3. #3
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: Reading Text file

    Actually, you can find an answer to that just by doing a search here: http://www.vbforums.com/search.php?

    You will see that most of the questions you will have have already been answered.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2005
    Posts
    89

    Re: Reading Text file

    Cool, thanks... I done a search and found what i was loooking for.

    Thanks.,..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width