views:

77

answers:

1

I didn't follow my own best practices (use only derived controls), and I dragged a regular Windows Forms control to my form, wired it up and used it on my form ;-(

Now I need to change the control to a derived control (derived from the same control), preserving all the settings from the designer. Is there a reliable/easy way to do this? (my current method is to remove the control, replace with the new control and ensure using differences to previous code that there are no changes other than in the class/namespace/assembly).

+2  A: 

In Windows Forms, it's easy enough to just fix the declaration and construction in the .designer file. Just change the declaration line and construction line to use your Control class instead of System.Windows.Forms.XXX.

Once you change those two lines, it should "just work" as if you used your derived control.

Reed Copsey
+1, this has always worked for me.
overslacked