VB.Net-Informations.com
   Home      .Net Framework      VB.NET      C#                                                                      About


  How to VB.NET FileStream operations

The FileStream Class represents a File in the Computer. FileStream allows to move data to and from the stream as arrays of bytes. We operate File using FileMode in FileStream Class

Some of FileModes as Follows :

FileMode.Append : Open and append to a file , if the file does not exist , it create a new file

FileMode.Create : Create a new file , if the file exist it will append to it

FileMode.CreateNew : Create a new File , if the file exist , it throws exception

FileMode.Open : Open an existing file

How to create a file using VB.NET FileStream ?

The following example shows , how to write in a file using FileStream.

         VB.NET Source Code Download           Print Source Code
         How to VB.NET FileStream operations - Download
        
C# Tutorial

Imports System.IO
Imports System.Text
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, _
	ByVal e As System.EventArgs) Handles Button1.Click
        Try
            Dim wFile As System.IO.FileStream
            Dim byteData() As Byte
            byteData = Encoding.ASCII.GetBytes("FileStream Test1")
            wFile = New FileStream("streamtest.txt", FileMode.Append)
            wFile.Write(byteData, 0, byteData.Length)
            wFile.Close()
        Catch ex As IOException
            MsgBox(ex.ToString)
        End Try
    End Sub
End Class

When we execute the program , it create a new File and write the content to it .

VB.NET Files Related Contents
*     How to VB.NET Directory operations
*     How to VB.NET File operations
*     How to VB.NET TextReader
*     How to VB.NET Simple TextReader
*     How to VB.NET TextWriter
*     How to VB.NET BinaryReader
*     How to VB.NET BinaryWriter


   Home      VB.NET      C#
VB.Net Related Topics
*     Microsoft .Net Framework Tutorials
*     VB.NET Language Basics Tutorials
*     VB.NET Program Flow Control Tutorials
*     VB.NET Collections Tutorials
*     VB.NET String Tutorials
*     VB.NET Files Tutorials
*     VB.NET Excel 2007 Tutorials
*     VB.NET Crystal Reports Tutorials
*     VB.NET Communications Tutorial
*     VB.NET ADO.NET Tutorial
*     ADO.NET Data Providers help and Tutorial
*     VB.NET ADO.NET Dataset Tutorial
*     ADO.NET DataAdapter and Dataset
*     VB.NET ADO.NET DataView Tutorial
*     VB.NET Remoting Tutorial
*     VB.NET XML Tutorial
*     VB.NET DataGridView Tutorial
   Home      VB.NET      C#
More Source Code :   
Mail to :  feedback@net-informations.com
  |  Home   |  VB.NET   |  C#   |  SiteMap   |  Terms of Use   |  About   |
net-informations.com (C) 2010
All Rights Reserved. All other trademarks are property of their respective owners.