Abstract Forms using WinForms
- by pm_2
I’m trying to achieve a similar affect in a WinForms application as a master form does with ASP.NET. My initial thoughts on this were to create a base form and declare it as abstract, but the compiler doesn’t seem to let me do this.
public abstract partial class Master : Form
{
public Master()
{
InitializeComponent();
}
}
So I have two questions:
Why will the compiler not let me do this? Am I using the wrong syntax or is this a genuine restriction.
Can anyone suggest a workaround or better way to do this?
EDIT:
InitializeComponent code:
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.Menu = this.mainMenu1;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Text = "Master";
this.AutoScroll = true;
}