"Thomas Scheiderich" <tf*@deltanet.com> wrote in message
news:10*************@corp.supernews.com...
The following code works fine. It opens file reads the data and then
closes.
************************************************** ************************** ****************
Dim objFileInfo As FileInfo = new FileInfo(strFilePath)
Dim objStream as StreamReader = objFileInfo.OpenText()
Dim strContents as String = objStream.ReadToEnd()
objStream.Close()
************************************************** ************************** ****************
Try the following:
Dim objReader As StreamReader = New StreamReader(strFilePath)
Dim strContents As String = objReader.ReadToEnd()
BTW, what do you mean when you call this a "binary file"? You're reading the
entire thing into a string, which is a "text file" sort of thing to do. If
you really meant to store binary data, you could try:
Dim objStream As FileStream = New FileStream(strFilePath)
Dim objReader As BinaryReader = New BinaryReader(objStream)
'
Dim i As Integer = objReader.ReadInt32()
Dim s As String = objReader.ReadString()
Dim f As Double = objReader.ReadDouble()
--
John Saunders
johnwsaundersiii at hotmail