Text after "
. I am trying to apply PrinterSettings (VB.NET 3.5), but reading back takes exceptions here is the code I am using. Works fine on other types of objects.
I have tried to change the default printer to a different printer, which has also used a Microsoft XPS document writer.
I read that serializing printersettings was a problem that was a .NET 1.1, but was correct in 2.0.
I'm sure it's something dumb I ...
dim p = new Printing.PrinterSettings dim L_PrintPageSettings = new System.Drawing.Printing.PageSettings P = L_PrintPageSettings.PrinterSettings try as dim objStreamWriter new StreamWriter ( "C: \ Product.xml") dim x new XmlSerializer (p.GetType) x.Serialize (objStreamWriter, P) (as objStreamWriter.Close) ' as a new object text file Deserialize objStreamReader dim new StreamReader for ( "C: \ Product.xml") dim p2 as new Printing.PrinterSettings p2 = x.Deserialize (objStreamReader) objStreamReader.Close () catch ex exception In form of Do end
class is not IXmlSerializable. Try the advantage of the fact that it is commented with Serializable attribute.
or a BinaryFormatter, or use a NetDataContractSerializer a DataContractSerializer (note that in the past the same .NET 3.5 SP1)
this is a human-readable output the production then you probably he would do would be best off using
see for example DataContractSerializer bottom of this article:
If you already If not familiar, how to use a Google search BinaryFormatter or NetDataContractSerializer
Comments
Post a Comment