This documentation is archived and is not being maintained.

Control.ContextMenuChanged Event

Occurs when the value of the ContextMenu property changes.

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

Public Event ContextMenuChanged As EventHandler
Dim instance As Control
Dim handler As EventHandler

AddHandler instance.ContextMenuChanged, handler

/** @event */
public void add_ContextMenuChanged (EventHandler value)

/** @event */
public void remove_ContextMenuChanged (EventHandler value)

In JScript, you can handle the events defined by a class, but you cannot define your own.
Not applicable.

This event is raised if the ContextMenu property is changed by either a programmatic modification or user interaction.

For more information about handling events, see Consuming Events.

The following code example displays a message when a change occurs to the shortcut menu.

Private Sub AddContextMenuChangedHandler()
   AddHandler Me.myTextBox.ContextMenuChanged, AddressOf TextBox_ContextMenuChanged
End Sub 'AddContextMenuChangedHandler

Private Sub TextBox_ContextMenuChanged(sender As Object, e As EventArgs)
   MessageBox.Show("Shortcut menu of TextBox is changed.")
End Sub 'TextBox_ContextMenuChanged

private void AddContextMenuChangedHandler()
    this.myTextBox.add_ContextMenuChanged(new EventHandler(
} //AddContextMenuChangedHandler

private void TextBox_ContextMenuChanged(Object sender, EventArgs e)
    MessageBox.Show("Shortcut menu of TextBox is changed.");
} //TextBox_ContextMenuChanged

Windows 98, Windows Server 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 Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0