Hi, I have a program that serializes a streamwriter like this:
Dim objStreamWriter As New StreamWriter("file.temp")
Dim x As New XmlSerializer(acct.items.GetType)
x.Serialize(objStreamWriter, acct.items)
objStreamWriter.Close()
I then have a function that can load that file and deserialize it. It all works great to save and load files.
I am now writing another program and need the same functionality, so I decided to copy and paste the code. It will not serialize correctly. It says that it has, but when I try to load it back in, it gives an error:
There is an error in XML document (1,7).
I tracked it down to this first line in the file:
<?xml /eroion="1.0" encoding="utf-8"?>
Obviously it needs to say version. The software does this automatically as far as I know.
What is going on, and how can I fix this?
Thanks!
Dim objStreamWriter As New StreamWriter("file.temp")
Dim x As New XmlSerializer(acct.items.GetType)
x.Serialize(objStreamWriter, acct.items)
objStreamWriter.Close()
I then have a function that can load that file and deserialize it. It all works great to save and load files.
I am now writing another program and need the same functionality, so I decided to copy and paste the code. It will not serialize correctly. It says that it has, but when I try to load it back in, it gives an error:
There is an error in XML document (1,7).
I tracked it down to this first line in the file:
<?xml /eroion="1.0" encoding="utf-8"?>
Obviously it needs to say version. The software does this automatically as far as I know.
What is going on, and how can I fix this?
Thanks!