Salut tout le monde,
Mon problème est le suivant : losque je veux sérialiser une form sous Csharp j'obtient l'erreur suivante :
Sachant que la méthode (de sérialisation) où le problème se déclenche est la suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8 An unhandled exception of type 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll Additional information: Type 'System.Windows.Forms.Form' in Assembly 'System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.
J'espere vous m'aidez car j'en ai vraiment besoin, merci.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 public static void Save() { //test c'est ma form test tst = new test(); tst.Show(); FileStream stream = File.Create("ser.dat"); BinaryFormatter formatter = new BinaryFormatter(); //Ou //SoapFormatter formatter = new SoapFormatter(); formatter.Serialize(stream, tst); stream.Close(); }
Partager