Shared menus

  • Thread starter Thread starter gcrasher
  • Start date Start date
G

gcrasher

I cannot figure out how to create a base form which implements a
common menu for all forms in the application. Does anyone know of any
sample code that demonstrates this? I've tried something like:

public class MyMainMenu : MainMenu
{
....basically add menu items in constructor

// singleton
public static readonly MyMainMenu instance = new MyMainMenu();

}

public class FormBase : System.Windows.Forms.Form
{
Public FormBase()
{
this.MainMenu = MyMainMenu.Instance();
}
}

Forms that extend FormBase are not showing the main menu. The only way
I get menus is to put this.Menu = MyMainMenu.Instance(); in the
FormActivate() event. It doesn't work in the constructor. Anyone know
how this is supposed to be done?
 
Back
Top