Trying to write data in a binary file more than once.

Hi guys,

I have been having problems all day with my program, I've searched the whole internet and I cant find a solution.

On my programm I have several checkboxes and I am trying to save them in a binary file. If I saved the data once it works perfectly but if I tried to save it twice it crashes and shows an error stating:

"An unhandled exception of type 'System.ObjectDisposedException' occurred in mscorlib.dll

Additional information: Cannot access a closed file."

I am using the command Write(); and it looks weird to me that it works the first time but then it crashes when i try to use it again.

Any help is welcome.


by electrogamerman via /r/csharp

Leave a Reply