views:

95

answers:

1

I am writing an application where I have indeterminate amount of Forms that require a certain popup-functionality (similar to MSN, a little window at the bottom right of the screen). I wrote the first form, then thought that I could copy the file to make a new one. So far so good. A bit later I realized that I could have subclassed Form, written my popup code, then subclassed my new PopupForm class to make the other forms, to simplify rewriting the popup code. So I did that, but now my forms don't show up properly in the Designer! They are completely white (no background image or controls) and I can't drag new controls onto it. I tried placing the

[Designer("System.Windows.Forms.Design.FormDocumentDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(IRootDesigner))]
[DesignerCategory("Form")]

attributes from the Form class on my new form, but it didn't help. I need to be able to alter the contents of my forms, and I don't see what's wrong, so this is both annoying and confusing.

+1  A: 

Did you remember to call the base constructor from your derived classes? It's important that InitializeComponent() gets called.

  class DerivedForm : BaseForm
  {
     public DerivedForm()
         : base()
     {
         // derived form's specific stuff
     }
  }
Groo
This happens automatically. Whenever you instantiate an instance of a derived class, the base parameterless constructor gets called as well unless if you specify a different constructor on the base.
BFree
@BFree Yes, that's what I believed too. It must be something else.
Bevin