Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EOF not working properly 1

Status
Not open for further replies.

visualJay

Programmer
Jun 14, 2001
57
US
The eof function is not working

1. dim cnt as int
2.
3. Open "file" For Input As #1
4. x = 0
5. Do Until (EOF(1))
6. cnt = cnt + 1
7. ReDim reportstring(x + 1, 4)
8. DoEvents
9. Loop
10. Close #1

this snipit of code throws error on line 6
cnt = max interger value but there is only 9 lines in the file. Am I doing something wrong? if so please explain!

 

You are not reading any data from the file so the eof is never met and your loop continues forever
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top