Auto Close in Windows Forms ContextMenuStrip (ContextMenuStripEx)

21 Aug 20231 minute to read

When AutoClose property of the ContextMenuStrip control is set to true, context menu will get closed when user clicks on any menu item or form. If this is not enabled, the menu items will not be closed even after any user action. By default it is set to true.

Below code snippet will explain how to set AutoClose property.

this.contextMenuStripEx1.AutoClose = true;
Me.contextMenuStripEx1.AutoClose = True