Trigger Menu Items in WinForms Context Menu Strip
18 Nov 20181 minute to read
On selection, the WinForms Context Menu Strip item functionality is handled through the Click event for further operations.
NOTE
Menu items can also be operated through keyboard shortcuts. TheClickevent will be invoked when pressing the shortcut keys.
The below code snippet shows how to append click event for menu items through code behind.
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
this.toolStripTextBox1.Click += new System.EventHandler(this.toolStripTextBox1_Click);
this.toolStripComboBox1.Click += new System.EventHandler(this.toolStripComboBox1_Click);AddHandler toolStripMenuItem1.Click, AddressOf toolStripMenuItem1_Click
AddHandler toolStripTextBox1.Click, AddressOf toolStripTextBox1_Click
AddHandler toolStripComboBox1.Click, AddressOf toolStripComboBox1_Click