designer serialization

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blackirish
    New Member
    • Sep 2008
    • 22

    designer serialization

    Hi all,
    i have a form with 3 textboxes and i have a class named user which has 3 members such as name, surname and age. I use the form to get user values design time and i want to serialize these values into the form designer. I can show the form at design time by using a ComponentDesign er. Here is a part of my code.

    Code:
    public class MyDesigner : ComponentDesigner
        {
            MyComponent CurrentController
            {
                get { return (MyComponent)this.Component; }
            }
            private DesignerVerbCollection actions;
    		public override DesignerVerbCollection Verbs
    		{
    			get
    			{
    				if(actions == null)
    				{
    					actions = new DesignerVerbCollection();
    					actions.Add(new DesignerVerb("EditorForm", new EventHandler(ChangeDisplay)));
    
    				}
    				return actions;
    			}
    		}
    
                     }
    
                void ChangeDisplay(object sender, EventArgs e)
               {
                EditorForm editor = new EditorForm(this);
                editor.ShowDialog();
               }
    }
    I also have a collection class which i hold user class members. What i need is to serialize the collection into designer at design time. I can serialize the values by using the collectionedito r but can't do that via my editor form.
    Any help would be greatly appreciated.
    Last edited by Plater; Sep 26 '08, 08:40 PM. Reason: removed initial line of -
  • nateraaaa
    Recognized Expert Contributor
    • May 2007
    • 664

    #2
    Have you tried adding the Serializable attribute to the Component class.

    [CODE=vbnet]<Serializable() >
    Public Class User()[/CODE]

    This site may help you
    http://www.vbdotnethea ven.com/UploadFile/ddutta/AttributesProgr amming041120050 61709AM/AttributesProgr amming.aspx

    Comment

    • blackirish
      New Member
      • Sep 2008
      • 22

      #3
      Originally posted by nateraaaa
      Have you tried adding the Serializable attribute to the Component class.

      [CODE=vbnet]<Serializable() >
      Public Class User()[/CODE]

      This site may help you
      http://www.vbdotnethea ven.com/UploadFile/ddutta/AttributesProgr amming041120050 61709AM/AttributesProgr amming.aspx
      Thanks for the reply nateraaaa. I tried it but it makes no difference. Moreover i can already serialize the form members via the custom collection editor which is displayed in the property grid when the component is selected. I just want to know how to serialize these values over the editor form i created.

      Comment

      Working...