Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
TitleCount the lines in a text file
Keywordscount lines, text file
CategoriesFiles & Directories
 
Read the file a line at a time and return the number of lines.
 
Private Function LinesInFile(ByVal file_name As String) As _
    Long
Dim fnum As Integer
Dim lines As Long
Dim one_line As String

    fnum = FreeFile
    Open file_name For Input As #fnum
    Do While Not EOF(fnum)
        Line Input #fnum, one_line
        lines = lines + 1
    Loop
    Close fnum

    LinesInFile = lines
End Function
 
This program uses disk, directory, and file list boxes to make selecting files easy.
 
 
Copyright © 1997-2001 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated