Hi,
It's clear in the message Form is not serializable.
What is the purpose of this? If you just want to create another similar form
in the current app then you need to implement it by yourself. I have no idea
how difficult it will be, especially if you have a lot of controls , You
will have to iterate in the Controls collection and create the same controls
with the same properties.
If you want to recreate it in another machine ( or process ) instead of
creating the controls you should send the properties values and in the
receiving end you will have to reconstruct the form.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Neeraj" <kn*******@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
>
hi
I want to make clone of current Form which is currently seen.I Used
attribute [Serializable] above the class declaration which extends
Form. Impleament the ICloneable interface and Make method which code is
public Object Clone()
{
return this.MemberwiseClone();
}
public static object DeepClone(
object obj)
{
object clone = null;
using (MemoryStream ms =
new MemoryStream())
{
BinaryFormatter bf =
new BinaryFormatter();
bf.Serialize(ms, obj);
ms.Position = 0;
clone = bf.Deserialize(ms);
}
return clone ;
}
but it generate SerializationException
which i show
Type 'System.Windows.Forms.Form' in Assembly 'System.Windows.Forms,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is
not marked as serializable.
At
bf.Serialize(ms, obj);
that Line.
any one have any idea regard this please share this.
with regards.
Neeraj