When starting a project, I always recommend inheriting objects from a base object, regardless of whether you know you'll need it or not. Usually, they will contain common functionality like error handling, debugging or other common methods which you'll use over and over.
In WinForms, however, this can cause a problem if you make the base form an abstract class (another thing I recommend). For example, take this simple form:
Now let's say I decide to derive this form from an abstract base class, which I will call BaseForm:
5 using System.Windows.Forms;
6
7 namespace TestForm
8 {
9 public abstract class BaseForm : Form
10 {
11 protected void SomeCommonMethod()
12 {
13
14 }
15 }
16 }
When I go to edit the UI again, I see this, and it scares the heck out of me (looks scarier in VS2005)....
What this is telling you is that it can't render an abstract class BaseForm. So while you are creating the application, you might remove the abstract identifier from UI related base classes (with a note that they should be inherited from, not used, as well as a /TODO marker to make sure you mark it as abstract before deployment).
Doing this will allow you to inherit from a base class while at the same time edit the UI.
Powered by: newtelligence dasBlog 2.3.9074.18820
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2012, © Copyright 2010
E-mail