NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

MenuItem.Enabled

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

[Visual Basic]
Public Property Enabled As Boolean
[C#]
public bool Enabled {get; set;}
[C++]
public: __property bool get_Enabled();
public: __property void set_Enabled(bool);
[JScript]
public function get Enabled() : Boolean;
public function set Enabled(Boolean);

Property Value

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

Remarks

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

Example [Visual Basic]

The following example initializes a menu that contains menu items for cut, copy, and delete operations based on whether a specific TextBox control, called Text1 in this example, has text selected within it. There are three menu items used in this example, called MenuCut, MenuCopy, and MenuDelete.

[Visual Basic]

Public Sub Popup(ByVal sender as System.Object, ByVal e as 
System.EventArgs)
   ' Determine if there is text selected in Edit1.
   if Edit1.SelectedText = "" Then
      ' Since there is no text selected in Edit1, disable the 
menus.
      MenuCut.Enabled = False
      MenuCopy.Enabled = False
      MenuDelete.Enabled = False
   Else
      ' Since there is text selected, enable the menus
      MenuCut.Enabled = True
      MenuCopy.Enabled = True
      MenuDelete.Enabled = True
   End If
End Sub

See Also

MenuItem Class | MenuItem Members | System.WinForms Namespace