Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / August 2005

Tip: Looking for answers? Try searching our database.

MenuItem - Am I missing something obvious?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Terry - 14 Aug 2005 17:51 GMT
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
Jakob Christensen - 15 Aug 2005 09:13 GMT
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.
Signature

http://www.dotninjas.dk
http://www.powerbytes.dk

> 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
[quoted text clipped - 6 lines]
> Thanks!
> Terry
Marcus - 15 Aug 2005 13:42 GMT
Terry,
Check out the MenuStart/MenuComplete events of your form.

- Marcus

> 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
[quoted text clipped - 6 lines]
> Thanks!
> Terry
Terry - 15 Aug 2005 15:49 GMT
> Terry,
> Check out the MenuStart/MenuComplete events of your form.
[quoted text clipped - 12 lines]
>> Thanks!
>> Terry

Ah!  Thank you!  That's exactly what I was looking for.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.