Technical Training
VB.NET 2005Working with File System in .NET Page - 2
Working with File System in .NET
.
.
.
Using StreamReader and StreamWriter Classes
StreamReader is useful for reading lines of information from standard text file and StreamWriter is useful for writing to standard text files. We shall see a an example that illustrates these functions.
-
Create a new Visual Basic Windows project.
-
Add a Label, a RichTextBox and four Buttons.
-
Arrange them on the form as shown in the following screenshot.

We are using the methods of FileStream, StreamReader and StreaWriter to create a file, write data to it and read from the file. The codes for the program are given below:
Click here to view sample code
The out put window and the text file the program has generated are shown below:
Opening Screen With text:

The program window after writing and reading Twice:
. 
The text file created is shown below:

Using BinaryReader and BinaryWriter Classes
-
Create a new project as Windows Application.
-
Add two Buttons, a Label and a RichTextBox t the form.
-
Arrange the controls so that the form looks like the screenshot given below:

Now add the following code to the form.
Click here to view sample code
This program will create a binary file and also read the binary file. Now press F5 to execute the program. A form will appear. Click the button ReadWrite. The output of the program is shown below:

The bin file that was created by this action is opened with text editor and shown below:

VB.NET 2005
- VB.NET 2005 Free Training
- The .NET Framework Architecture Part 1
- The .NET Framework Architecture Part 2
- Application Class and Message Class
- Implementing Class Library Object
- Visual Studio.NET Namespaces
- .NET Assemblies
- Differences between VB.NET 1.0 and VB.NET 2.0
- Introducing VB.NET Windows Forms
- Visual Studio Windows Forms Designer
- Exploring the Forms Designer generated code
- Setting and Adding Properties to Windows Form
- Implementing Inheritance
- Event Handling In Visual Basic .NET
- Building Graphical Interface elements
- .NET Common Windows Forms Controls Part 1
- .NET Common Windows Forms Controls Part 2
- Common Controls and Handling Control Events
- DomainUpDown and NumericUpDown Controls
- Dialog Boxes in Visual Basic .NET
- Visual Studio Adding Controls to Windows Form
- VB.NET Validation Controls
- Working with Menu Controls
- VB.NET MDI Applications
- .NET Exceptions
- VB.NET Creating and Managing Components Part 1
- VB.NET Creating and Managing Components Part 2
- Simple Data Binding
- .NET Complex Data Binding
- .NET Data Form Wizard
- Data Manipulation with ADO.NET
- SQL Server Stored Procedures
- SQL Server Ad Hoc Queries
- Finding and Sorting Data in DataSets
- ADO.NET Object Model
- Working with DataSets
- Using XML Data
- Working with File System in .NET
- Creating Web Service
- Instantiating - Invoking Web Services, Creating Proxy Classes with WSDL
- Web Reference and Web Services
- Web Services - SOAP, WSDL, Disco and UDDI
- Web Application Testing in VB.NET 2005
- Web Application Tracing and Debugging
- Working with Legacy Code and COM Components
- ActiveX Controls and Legacy Code
- Windows Application Testing
- VB.NET Windows Application Testing
- Tracing VB.NET Windows Application
- Debugging Windows Applications In Visual Studio.NET 2005
- Deploying Windows Applications In Visual Studio.NET 2005
- Customizing Setup Project in Visual Studio.NET 2005
- Shared Assembly
- Microsoft .NET Creating Installation Components
- The Registry Editor in Visual Studio.NET 2005
- The File Types Editor







