473,405 Members | 2,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

... not marked as serializable.

Hi again

I have a little problem with "serializable" a control ...

I am creating AppDomain, Assembly and Instance. All works fine.
My "base" class for the instance inherit from:
- System.MarshalByRefObject
- and also my Interface.
In my "base" class I refer to a Form.
I am able to access the form but not the controls. I get the exeption:
Type 'System.Windows.Forms.Form+ControlCollection' in assembly
'System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' is not marked as serializable.

How do I mark this form and/or the controls on it as serializable ??

Thank you for any comment !

Best regards
Frank Uray
Mar 30 '06 #1
2 14902
You can not serialize a form as it holds native references. If it is
absolutely necessary to serialize a windows form, create a custom Form,
inherit from "Form" and implement ISerializable.
I would have marked the form instance "NonSerialized"
(System.NonSerializedAttribute)

--
Abhijeet Dev

"Frank Uray" <Fr*******@discussions.microsoft.com> wrote in message
news:A6**********************************@microsof t.com...
Hi again

I have a little problem with "serializable" a control ...

I am creating AppDomain, Assembly and Instance. All works fine.
My "base" class for the instance inherit from:
- System.MarshalByRefObject
- and also my Interface.
In my "base" class I refer to a Form.
I am able to access the form but not the controls. I get the exeption:
Type 'System.Windows.Forms.Form+ControlCollection' in assembly
'System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' is not marked as serializable.

How do I mark this form and/or the controls on it as serializable ??

Thank you for any comment !

Best regards
Frank Uray

Mar 30 '06 #2
Hi

Thank you for your answer!
Just one more little question:
Where can I mark the instance as "NonSerialized" ??

I am doing this:
System.AppDomain local_AppDomain =
System.AppDomain.CreateDomain("DynamicDomain");
System.Reflection.AssemblyName local_AssemblyName = new
System.Reflection.AssemblyName();
local_AssemblyName.CodeBase = @"C:\Temp\Test";
local_AssemblyName.Name = "sCONTROL_SSSP";

System.Reflection.Assembly local_Assembly;
local_Assembly = local_AppDomain.Load(local_AssemblyName);

sCONTROLInterface.sCONTROLInterface local_InterfaceObject =
(sCONTROLInterface.sCONTROLInterface)local_AppDoma in.CreateInstanceAndUnwrap("sCONTROL_SSSP", "sCONTROL_SSSP.clsRemote");

The class "clsRemote" implements "sCONTROLInterface" Interface
and also "System.MarshalByRefObject".
"public class clsRemote : System.MarshalByRefObject, sCONTROLInterface"
Without System.MarshalByRefObject it wont work ...
In this class are also the references to the form defined.

Can you give me one more idea ??

Best regards
Frank Uray

"Abhijeet Dev" wrote:
You can not serialize a form as it holds native references. If it is
absolutely necessary to serialize a windows form, create a custom Form,
inherit from "Form" and implement ISerializable.
I would have marked the form instance "NonSerialized"
(System.NonSerializedAttribute)

--
Abhijeet Dev

"Frank Uray" <Fr*******@discussions.microsoft.com> wrote in message
news:A6**********************************@microsof t.com...
Hi again

I have a little problem with "serializable" a control ...

I am creating AppDomain, Assembly and Instance. All works fine.
My "base" class for the instance inherit from:
- System.MarshalByRefObject
- and also my Interface.
In my "base" class I refer to a Form.
I am able to access the form but not the controls. I get the exeption:
Type 'System.Windows.Forms.Form+ControlCollection' in assembly
'System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' is not marked as serializable.

How do I mark this form and/or the controls on it as serializable ??

Thank you for any comment !

Best regards
Frank Uray


Mar 30 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David Elliott | last post by:
I have a 3rd Party DLL that is a Win32 NOT .NET Assembly that is misbehaving. I am trying to isolate it in its own AppDomain. I got to load but can not create an instance. I receive the following...
3
by: Barguast | last post by:
Has anyone got any idea what might be causing this message to be shown? It occurs whenever I try to copy / cut my custom control from the Form Designer: ...
1
by: Harshdeep Mehta | last post by:
Hi all, I have written a page in which I want to preserve value of object - suppose A - value, so I used viewstate. but that give me error. Code : ViewState = objClassA; // Before PostBack...
2
by: jeffpriz | last post by:
I'm having trouble.. I created a small class that I pass to my Pages, and I want to put that class into Viewstate.. I do: Viewstate.add("thisVar", myClassVariable) and i receive the lovely...
2
by: Prakash | last post by:
Hi Friends, In my C# application, i have tried to serialize some structured data using Soapformatter. While calling the serialize funciton i got the exception message like "mscorlib....The...
1
by: Yogesh Parab | last post by:
In our application we havr presentation layer and business laye. The presentation layer interacts with business layer using webservice. We need to store the object from the Business layer in the...
0
mmfranke
by: mmfranke | last post by:
Hello. Hi. I'm writing a logging service that uses .NET remoting. The idea is that the service publishes an EventProcessor object that clients can access via .NET Remoting, passing it...
5
by: Nirdesh | last post by:
Hi, I am serializing a custom class holding some data for my project. This data internally contains a class which contains an event public delegate void MemberModifiedEventHandler(object...
2
by: amirghaffarie1362 | last post by:
i use below code for create arraylist() Dim ItemsT As New ArrayList() If ViewState("items") IsNot Nothing Then ItemsT = DirectCast(ViewState("items"), ArrayList) ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.