ToolStripMenuItem.ShortcutKeys Property

Note: This property is new in the .NET Framework version 2.0.

Gets or sets the shortcut keys associated with the ToolStripMenuItem.

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

public Keys ShortcutKeys { get; set; }
/** @property */
public Keys get_ShortcutKeys ()

/** @property */
public void set_ShortcutKeys (Keys value)

public function get ShortcutKeys () : Keys

public function set ShortcutKeys (value : Keys)

Property Value

One of the Keys values. The default is None.

Exception typeCondition


The property was not set to one of the Keys values.

Use the ShortcutKeys property to assign a key combination to a menu command, such as CTRL+C for the Copy command. You can use shortcut keys instead of or in addition to access keys, which are underscored letters in menus or menu items used with the ALT key. Define access keys in code by typing an ampersand (&) before the letter you want to use for an access key.

The following code example assigns the CTRL+O shortcut keys to the Open command of a File menu on a MenuStrip control. This code example is part of a complete example in the MenuStrip class summary.

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0