Debmedia Creation Forum
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Text File To Binary File in VB.net

Go down

Text File To Binary File in VB.net Empty Text File To Binary File in VB.net

Post  Admin Thu Jan 29, 2009 4:00 pm

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
Admin
Admin
Admin

Posts : 256
Join date : 2008-06-06

https://debmedia.forumotion.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum