Jump to content

Serialization of a custom button dinamically created

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
agetto

agetto

    Newbie

  • Members
  • Pip
  • 5 posts
I am writing an application partly configurabile from users.
When the user presses " new button " the application creates a new button completely configurabile. My problem is that when I close the application all the information related to the creation of the new button are lost.
I know that I would owe serialize the class button but I don't know whether to create (builders, property, etc..) and then as to use in the code of the form?
I have looked for this in MSDN' s forums but I have found only an example written in VB, from which, honestly I don't succeed in shifting me
If someone has some practical example in c# on the serialization of a custom class button I would be indeed him thankful ... help

Edited by agetto, 26 August 2008 - 03:10 AM.


#2
agetto

agetto

    Newbie

  • Members
  • Pip
  • 5 posts
I've found a solution thanks however,

#3
MeTh0Dz

MeTh0Dz

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,119 posts
Okay. Dynamically.

#4
agetto

agetto

    Newbie

  • Members
  • Pip
  • 5 posts
here is the class that i used to do the serialization

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Linq;
using System.Xml.Linq;

namespace PulseClass
{
[Serializable()]
public class PulseClass
{
private string mName;
private string mText;
private Point mLocation;
public PulsanteClass(Button btn)
{
this.mName = btn.Name;
this.mLocation = btn.Location;
this.mText = btn.Text;
}
public string Name
{
get
{
return this.mName;
}
set
{
this.mName = value;
}
}
public Point Location
{
get
{
return this.mLocation;
}
set
{
this.mLocation = value;
}
}
public string Text
{
get
{
return this.mText;
}
set
{
this.mText = value;
}
}
}
}

#5
Xav

Xav

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 13,118 posts
Use CODE tags, please. But interesting code nevertheless.
Jordan said:

Good members, like yourself, stick around and post for ages to come!
Mr. Xav | Blog | Forums