Example - Sequential Access
The source code needed for this example is stored
in the "Source Code\Chapter18\Sequential" directory.
Private Sub cmdRead_Click()
Dim strLine As String
Open App.Path & "\numbers.txt"
For Input As #1
lstShow.Clear
Do Until (EOF(1))
Line Input #1,
strLine
lstShow.AddItem
strLine
Loop
Close #1
End Sub
When the user clicks the cmdRead button, the program
opens a file named "numbers.txt" for sequential
access, reads data from that file and adds data to
a list box(lstShow). The EOF Function returns an Integer
containing the Boolean value True when the end of
a file opened for Random or sequential Input has been
reached.
|