Serializing an extended form object

Posted by andyperfect on Stack Overflow See other posts from Stack Overflow or by andyperfect
Published on 2010-06-02T22:23:49Z Indexed on 2010/06/02 22:34 UTC
Read the original article Hit count: 183

Filed under:
|
|

I've been reading up on this whole subject, but I never came across this specific problem. I already understand that the whole idea of serializing an entire form is a horrible idea and just doesn't work. But, I am encountering a bit of a different problem. I have a class that inherits the "button" form object, that I call DataButton.

Now for my problem. I want to be able to serialize this class, but I don't need any of the information from the actual button class. Is there any way to bypass the fact that I can't set the button form object to Serializable() and notify VB that when serialization is to occur, it should simply skip over that information? Theoretically, if such a procedure were possible, I'd be able to do the entire serialization without a hitch.

I came up with the idea earlier of removing the "inherits" feature from the class, and having simply a button within the class, but that makes my program really difficult to work with as I am constantly changing the location, size, backgroundImage, text, and whatnot. Thus, immediate updates would be much tougher to work with.

Any help would be greatly appreciated.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about vb.net