C#: Does Serializable() attribute prevent passing a class instance to another form?

You error has no relation with Serializable attribute. Problem lies in below lines of code.

You error has no relation with Serializable attribute. Problem lies in below lines of code: setForm = new settingsForm(); setForm.Show(); setForm. Cf = _cf; SettingsForm constructor is using configurator but you are setting it after constructor is called.

You may pass the configurator via constructor to solve your issue.

– Bildsoe Sep 23 '10 at 13:55 @Blidsoe, sorry for that - I have edited my answer. – VinayC Sep 23 '10 at 13:57 Thanks - do I accept your answer, or can I delete this post, since it is posted in the wrong place? – Bildsoe Sep 23 '10 at 13:57.

The code you pasted does not work because you access _configurator in the Constructor of settingsForm. You should instead create a Constructor that accepts a Config instance. The Serialization Attribute is not the cause of your error.

You're trying to display information about the configutor in the constructor, when the cf variable doesn't get set until after you show the form.

I'm going to go out on a limb and say that's it because you never instantiate your class. Only code I see is: Config _configutor = null.

It's assigned in the property setter (the next line of code). – Fredrik Mörk Sep 23 '10 at 13:59 That's in a user control class though, not his Form class. – Coding Gorilla Sep 23 '10 at 14:14.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions