Guest spike232 Posted October 3, 2002 Posted October 3, 2002 i have the following code that works for binary serilisation: Private Sub binarysave(ByRef hold As Object, ByVal filename As String) Dim s As Stream = New FileStream(filename, FileMode.Create) Dim b As BinaryFormatter = New BinaryFormatter() b.Serialize(s, hold) s.Close() End Sub however the folloing to do the same but using xml insted does not work, any ideas?? Private Sub xmlsave(ByRef hold As settings, ByVal filename As String) Dim s As Stream = New FileStream(filename, FileMode.Create) Dim x As XmlSerializer = New XmlSerializer(GetType(settings)) x.Serialize(s, hold) s.Close() End Sub Quote
*Gurus* divil Posted October 3, 2002 *Gurus* Posted October 3, 2002 Perhaps hold should be declared as an object? Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Guest spike232 Posted October 3, 2002 Posted October 3, 2002 i had that originaly it made no difference, if i change the type pased to XmlSerializer to object it failes on the x.Serialize(s, hold) line with error: An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll Additional information: There was an error generating the XML document. insted of the line Dim x As XmlSerializer = New XmlSerializer(GetType(settings)) with error: An unhandled exception of type 'System.InvalidOperationException' occurred in system.xml.dll Additional information: There was an error reflecting 'MSN_No_Cut_Off.settings'. and the class settings has been declared with <Serializable()> Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.