markp15
05-28-2004, 02:16 PM
I have written a program that is supposed to read the number of lines in a file and the number of characters in that file. The line count works but the number count is way off. Can't figure out what I have done wrong, any help would be great.Dim file As String
Dim textline As String
Dim counter As Integer
Private Sub cmdexit_Click()
'Exit the program
Call Unload(frmstats)
End Sub
Private Sub cmdstatistics_Click()
'Count the lines and letters in the file
counter = 0
Open "C:\" & txtfilename.text For Input As #1
Do While Not EOF(1)
Line Input #1, textline
counter = counter + 1
lbllinesanswer.Caption = counter
Loop
Close #1
'It's this Part that does not work right
Open "C:\" & txtfilename.text For Input As #1
Line Input #1, file
lblcharanswer.Caption = Len(file)
Close #1
End SubThanks
Mark
Dim textline As String
Dim counter As Integer
Private Sub cmdexit_Click()
'Exit the program
Call Unload(frmstats)
End Sub
Private Sub cmdstatistics_Click()
'Count the lines and letters in the file
counter = 0
Open "C:\" & txtfilename.text For Input As #1
Do While Not EOF(1)
Line Input #1, textline
counter = counter + 1
lbllinesanswer.Caption = counter
Loop
Close #1
'It's this Part that does not work right
Open "C:\" & txtfilename.text For Input As #1
Line Input #1, file
lblcharanswer.Caption = Len(file)
Close #1
End SubThanks
Mark