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


  How to VB.NET BinaryWriter

The BinaryWriter Object works at lower level of Streams. BinaryWriter is used for write premitive types as binary values in a specific encoding stream. BinaryWriter Object works with Stream Objects that provide access to the underlying bytes. For creating a BinaryWriter Object , you have to first create a FileStream Object and then pass BinaryWriter to the constructor method .

Dim writeStream As FileStream

writeStream = New FileStream("c:\testBinary.dat", FileMode.Create)

Dim writeBinay As New BinaryWriter(writeStream)

The main advantages of Binary information is that it is not easily human readable and stores files as Binary format is the best practice of space utilization.

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

Imports System.IO
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
        Dim writeStream As FileStream
        Try
writeStream = New FileStream("c:\testBinary.dat", FileMode.Create)
            Dim writeBinay As New BinaryWriter(writeStream)
            writeBinay.Write("This is a test for BinaryWriter !")
            writeBinay.Close()
        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub
End Class

BinaryReader you can use in the same way to read as binary.

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


   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.