I've made a class which inherits from UserControl, but which I only want to use as a base for subclasses. Is there a way I can stop VS2008 from trying to edit it in the designer, that won't stop the subclasses from being edited in the designer?
There is. I believe if you have multiple classes in a file, VS looks at the first one only, but I may be mistaken. In any case, this should do the trick:
[System.ComponentModel.DesignerCategory("Code")]
public class SomeBaseClass : UserControl
{
//...
}
Note that in versions of Visual Studio prior to 2017, you must use the full name of the attribute as shown above. If you try putting a using statement above it and simply trying "DesignerCategory" visual studio may not honor it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With