MenuItem - Am I missing something obvious?

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

I've got a pretty standard menu at the top of my main form, and the
MenuItem's have event handlers for the "Select" event to update the
statusbar text, but what I can't seem to find is a way to know when the user
has cancelled the menu without clicking anything so I can clear the
statusbar text.

I feel like I'm missing something obvious. Does anyone know how to do this?

Thanks!
Terry
 
All your menu items (including the main menu) must use the same event handler
for the Select event. In the event handler you can put code similar to the
following code:

private void menuItem_Select(object sender, System.EventArgs e)
{
if (sender == menuItem2)
this.statusBar1.Panels[0].Text = "Menu 2";
else if (sender == menuItem3)
this.statusBar1.Panels[0].Text = "Menu 3";
else
this.statusBar1.Panels[0].Text = "Ready";
}

When the user cancels the menu the statusbar will show the text "Ready".

HTH, Jakob.
 
Back
Top