I'm sure this info is available in a million places... if you search for the right thing.
As most of you know I am traditionally a VB/VB.Net developer who has transitioned to the bilingual world. There are still some odd bits and pieces that trip me up from time to time. Today was one of those times. I was trying to create a "base form" in C# in which all other forms could inherit from. To do this I created a BaseForm abstract class in my UI project with two abstract methods. I then created my first form "Form1" which inherited from my BaseForm class....
All seemed to work just fine for a while. The application even executed as planned in Debug mode. I'm not sure exactly what changed, but at one point I went to open "Form1" in designer mode only to receive an error in VS...
"The designer must create an instance of type 'BaseForm' but it cannot because the type is declared as abstract."
Well thanks to this article on code project I got turned in the right direction. It made me realize that I needed to create a separate Windows Application then convert it to a Class Library. Once I did that, I moved my BaseForm to the new Class Library project. Once that was done I had to remove the "abstract" from the BaseForm class declaration and change my abstract methods in the BaseForm to virtual methods with empty bodies. Then I had to add a reference to the new Class Library, and add a "using bla;" to my Form1 {bla = my new Class Library name}.
Then VS was able to display my Form1 without error and I still achieved the desired contract enforcement requiring my Form1 and all forms that inherited from BaseForm to include the common methods of BaseForm.
--chaz