Text File To Binary File in VB.net
Page 1 of 1
Text File To Binary File in VB.net
Public Sub BinarySerialize()
'Create a streamreader class
Dim objStreamReader As StreamReader
'open the file
objStreamReader = File.OpenText("c:\\Mystore1.txt")
'Read the file storing it in the readfile string
Dim readfile As String = objStreamReader.ReadToEnd()
Dim flStream As FileStream = New FileStream("c:\\myStore.txt", FileMode.OpenOrCreate, FileAccess.Write)
Try
Dim bFormatter As BinaryFormatter = New BinaryFormatter
bFormatter.Serialize(flStream, readfile)
Finally
flStream.Close()
objStreamReader.Close()
End Try
End Sub
'Create a streamreader class
Dim objStreamReader As StreamReader
'open the file
objStreamReader = File.OpenText("c:\\Mystore1.txt")
'Read the file storing it in the readfile string
Dim readfile As String = objStreamReader.ReadToEnd()
Dim flStream As FileStream = New FileStream("c:\\myStore.txt", FileMode.OpenOrCreate, FileAccess.Write)
Try
Dim bFormatter As BinaryFormatter = New BinaryFormatter
bFormatter.Serialize(flStream, readfile)
Finally
flStream.Close()
objStreamReader.Close()
End Try
End Sub
Similar topics
» DOES YOU WANT TO CREATE A FILE WITH ANY SIZE YOU NEED? EXP: A TEXT FILE OF 100 MB WITHOUT A SINGLE TEXT!!!!!!
» Read Binary FIle in VB.net
» Get all File Size from File List box in VB.net
» Select all Items of a listbox or file list box
» Read Binary FIle in VB.net
» Get all File Size from File List box in VB.net
» Select all Items of a listbox or file list box
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum