O'Reilly logo

Visual Basic 2005 for Programmers: Deitel Developer Series, Second Edition by Harvey M. Deitel - Deitel & Associates, Inc., Paul J. Deitel - Deitel & Associates, Inc.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

18.10. Reading and Deserializing Data from a Sequential-Access Text File

The preceding section showed how to create a sequential-access file using object serialization. In this section, we discuss how to read serialized objects sequentially from a file.

Figure 18.15 reads and displays the contents of the file created by the program in Fig. 18.14. Line 10 creates the BinaryFormatter that will be used to read objects. The program opens the file for input by creating a FileStream object (line 35). The name of the file to open is specified as the first argument to the FileStream constructor.

Figure 18.15. Sequential file read using deserialzation.
					1
					' Fig. 18.15: FrmReadSequentialAccessFile.vb
					2
					' Reading a sequential-access file using deserialization. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required