Results 1 to 3 of 3

Thread: VB6-Reading txt file

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2006
    Posts
    274

    VB6-Reading txt file

    How to read certain line in a txt file, for example to read line 3 or reading from line 3 to 10 ?

  2. #2
    Frenzied Member cssriraman's Avatar
    Join Date
    Jun 2005
    Posts
    1,465

    Re: VB6-Reading txt file

    CS

  3. #3
    Oi, fat-rag! bushmobile's Avatar
    Join Date
    Mar 2004
    Location
    on the poop deck
    Posts
    5,592

    Re: VB6-Reading txt file

    or:
    VB Code:
    1. Dim sLines() As String, N As Long
    2.  
    3. Open "C:\test.txt" For Input As #1
    4.     sLines = Split(Input(LOF(1), #1), vbCrLf)
    5. Close #1
    6.  
    7. ' Line 3 (it's 0-based)
    8. Debug.Print sLines(2)
    9.  
    10. ' Lines 3 to 10
    11. For N = 2 To 9
    12.     Debug.Print sLines(N)
    13. Next N

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