Control designer for custom user control property

R

Rhy Mednick

I have a control that I've created and it exposes several formatting
properties through a "Format" member. I've created a control designer that
gets activated in Visual Studio through a designer verb. The designer gets
activated and is able to read and write to the special Format property of my
control. However, when I run the program all my changes are lost. My Format
property doesn't show up in the properties area of VS for the control, but I
know my property has been changed because when I reopen the designer it
reflects the changes.

I suppose that this behavior makes sense because Visual Studio doesn't know
anything about my Format property which I create from a custom class. Do I
need to provide some special serialization routines in my designer to save
my changes in the form? If so, how do I go about doing that. I have a book
that taught me how to create the designer but the only properties it ever
changes in its demo are ones that show up in the properties window.

Thanks for the help.
- Rhy
 
E

Ernest Morariu

I suppose that this behavior makes sense because Visual Studio doesn't
know
anything about my Format property which I create from a custom class. Do I
need to provide some special serialization routines in my designer to save
my changes in the form?

Try to add the <Serializable> attribute to your custom class(the type of the
Format property).

Ernest
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top