Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27360

VS 2010 [RESOLVED] Saving an Array to a file

$
0
0
I have a 2d array of boolean data that I want to save to a a file and then later read it back, when I re-start my program.

Is there a really easy way to do this? I have tried the following, but have problems when trying to read the file ...

FileOpen(1,"FileData.dat", OpenMode.Binary, OpenAccess.Write)
FilePutObject(1,ArrayData)
FileClose(1)

That seems to work okay, the file is created ...

When I want to read it ...

FileOpen(1,"FileData.dat", OpenMode.Binary, OpenAccess.Read)
FileGetObject(1,ArrayData)
FileClose(1)

When this code is executed, the FileGetObject statement causes ...

A first chance exception of type 'System.IO.EndOfStreamException' occurred in Microsoft.VisualBasic.dll

The array is defined as ...

Dim ArrayData(20, 23) as Boolean

I am not sure what I am doing wrong here... Any help?

Viewing all articles
Browse latest Browse all 27360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>