System.Windows.Forms.Menu.GetMainMenu Method

Gets the System.Windows.Forms.MainMenu that contains this menu.

Syntax

public MainMenu GetMainMenu ()

Returns

The System.Windows.Forms.MainMenu that contains this menu.

Remarks

This method allows you to obtain a reference to the System.Windows.Forms.MainMenu this menu is currently located in. This property returns null if the menu is not contained in a System.Windows.Forms.MainMenu. This can occur if the menu is contained in a System.Windows.Forms.MenuItem or System.Windows.Forms.ContextMenu, or if the menu is not contained in any menu. You can use this property to determine whether a menu is currently being used, and also to determine where.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0