O'Reilly logo

Microsoft® Visual Basic® .NET 2003 Kick Start by Joel Semeniuk, Erik Porter, Andy Baron, Duncan Mackenzie

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

Reading and Writing to a Text File

To illustrate the use of streams, I will walk you through creating a simple Windows Forms application that reads in and writes out text files. Of course, text files (and even files in general) are just one example of streams. The code to work with streams is generic enough that the same techniques demonstrated in this sample to read and write files would work against something more interesting such as a MemoryStream.

Configuring a New Windows Application

For the first step, create a new Windows Forms project. Call it ReadWriteFile. Add one each of the MainMenu, OpenFileDialog, SaveFileDialog, and TextBox controls to the form. Set the properties as in Table 4.3, by selecting each control and then changing the ...

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