Saving files

rbulph

Well-known member
Joined
Feb 17, 2003
Messages
343
Im trying to save files. They save OK the first time, i.e. when theyre created, but I cant successfully save the changes. Heres the code Im using:

Code:
Dim TestFileStream As Stream

        TestFileStream = File.Open(FullPath, FileMode.Create, FileAccess.Write)

        Dim serializer As New BinaryFormatter
        serializer.Serialize(TestFileStream, Me.SerializationCol)
        TestFileStream.Close()

In relation to FileAccess.Write the helpfile says:

"Specifies that the operating system should create a new file. If the file already exists, it will be overwritten. This requires FileIOPermissionAccess.Write. System.IO.FileMode.Create is equivalent to requesting that if the file does not exist, use CreateNew; otherwise, use Truncate. ", but the link for FileIOPermissionAccess.Write is broken.

How do I get my files to save properly?
 
Fixed it thanks. I was missing something very simple - too much Christmas spirit on my part, no doubt.
 
Back
Top