Click here to Skip to main content
15,918,333 members
Home / Discussions / C#
   

C#

 
GeneralRe: All C# fan want to know Pin
Heath Stewart3-Dec-03 3:29
protectorHeath Stewart3-Dec-03 3:29 
GeneralRe: All C# fan want to know Pin
lajiyo3-Dec-03 22:13
lajiyo3-Dec-03 22:13 
GeneralInsert an image into your message Pin
Asim N.1-Dec-03 1:26
Asim N.1-Dec-03 1:26 
GeneralC# vs Sound compression Pin
paladin20031-Dec-03 0:25
paladin20031-Dec-03 0:25 
GeneralRe: C# vs Sound compression Pin
Heath Stewart1-Dec-03 2:44
protectorHeath Stewart1-Dec-03 2:44 
GeneralRe: C# vs Sound compression Pin
paladin20031-Dec-03 4:57
paladin20031-Dec-03 4:57 
GeneralRe: C# vs Sound compression Pin
Heath Stewart1-Dec-03 6:23
protectorHeath Stewart1-Dec-03 6:23 
QuestionSerialize a button? Pin
thomasa30-Nov-03 22:24
thomasa30-Nov-03 22:24 
I'm trying to save a Button object to a file, with the following code:

[Serializable]
public class SaveSettings
{
public System.Windows.Forms.Button btn = new
System.Windows.Forms.Button();
}

System.Windows.Forms.Button testBtn = new System.Windows.Forms.Button();
SaveSettings.btn = testBtn;
Serializer.Serialize(settings.btn,"C:\\aButton.btn");

public static void Serialize(object Object, string FileName)
{
BinaryFormatter bformatter = new BinaryFormatter();
Stream stream = File.Open(FileName, FileMode.Create);
bformatter.Serialize(stream, Object);
stream.Close();
}

But I get the following exception:

An unhandled exception of
type 'System.Runtime.Serialization.SerializationException' occurred in
mscorlib.dll

Additional information: The type System.Windows.Forms.Button in Assembly
System.Windows.Forms, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 is not marked as serializable.

What is wrong? How can I make it serializable?

I'm also trying with a Panel(containg butttons) and a TreeView(containing nodes), it all results in the same exception.(Simpel things as an ArrayList,string, int or double works fine)


Thanks in advance for your help Rose | [Rose] ,
Thomas

AnswerRe: Serialize a button? Pin
unitrunker30-Nov-03 22:44
unitrunker30-Nov-03 22:44 
GeneralRe: Serialize a button? Pin
thomasa30-Nov-03 22:56
thomasa30-Nov-03 22:56 
GeneralRe: Serialize a button? Pin
Corinna John1-Dec-03 1:23
Corinna John1-Dec-03 1:23 
GeneralRe: Serialize a button? Pin
Heath Stewart1-Dec-03 2:35
protectorHeath Stewart1-Dec-03 2:35 
QuestionHow to change next page of our choice in tabcontrol Pin
Inam30-Nov-03 21:51
Inam30-Nov-03 21:51 
AnswerRe: How to change next page of our choice in tabcontrol Pin
Corinna John1-Dec-03 1:26
Corinna John1-Dec-03 1:26 
GeneralClear screen from a C# console Application Pin
okoji Cyril30-Nov-03 21:35
okoji Cyril30-Nov-03 21:35 
GeneralRe: Clear screen from a C# console Application Pin
Alex Korchemniy1-Dec-03 11:02
Alex Korchemniy1-Dec-03 11:02 
Questiondatagrid problem? Pin
isarfraz30-Nov-03 18:13
isarfraz30-Nov-03 18:13 
AnswerRe: datagrid problem? Pin
Heath Stewart1-Dec-03 2:27
protectorHeath Stewart1-Dec-03 2:27 
GeneralPrintTemplate.orientation bug Pin
Alex Korchemniy30-Nov-03 17:25
Alex Korchemniy30-Nov-03 17:25 
GeneralMaking an exe file from c# code Pin
kaisy30-Nov-03 16:15
kaisy30-Nov-03 16:15 
GeneralRe: Making an exe file from c# code Pin
Christian Graus30-Nov-03 17:02
protectorChristian Graus30-Nov-03 17:02 
GeneralRe: Making an exe file from c# code Pin
Alex Korchemniy30-Nov-03 17:31
Alex Korchemniy30-Nov-03 17:31 
GeneralAbout Hook Pin
lajiyo30-Nov-03 15:06
lajiyo30-Nov-03 15:06 
GeneralCore DLL Documentation Pin
Tristan Rhodes30-Nov-03 12:04
Tristan Rhodes30-Nov-03 12:04 
GeneralRe: Core DLL Documentation Pin
Alex Korchemniy30-Nov-03 14:13
Alex Korchemniy30-Nov-03 14:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.