MenuItem.Enabled Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets a value indicating whether the menu item is enabled.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member Enabled : bool with get, set

Property Value

Type: System.Boolean

true if the menu item is enabled; otherwise, false. The default is true.

A MenuItem that is disabled is displayed in a gray color to indicate its state. When a parent menu item is disabled, all submenu items are not displayed.

The following code example demonstrates how to use the Popup event to determine whether MenuItem objects that provide support for cut, copy, and delete operations are enabled before the menu they are displayed in is shown. The example determines if textBox1, a TextBox control on the form, is enabled, has input focus, and has text selected before enabling the MenuItem objects. This example requires that three MenuItem objects are created named menuCut, menuCopy, and menuDelete have been created.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: