Solved

Windows Programming - Menus

Posted on 2004-04-22
3
238 Views
Last Modified: 2010-04-17
Hi,

I have a menu using check marks.  Each time I select an option from the menu I want the option to be checked and all other options to be unchecked.  Does anybody know how I can "refresh" the menu bar after selecting an option as after selecting nothing is changing.

Thanks,
Adrian
0
Comment
Question by:Adrian_Buz
3 Comments
 
LVL 1

Expert Comment

by:curt_henderson
ID: 10893121
What development environment are you using?
0
 

Author Comment

by:Adrian_Buz
ID: 10894460
I'm using C
0
 
LVL 1

Accepted Solution

by:
edkaas earned 50 total points
ID: 10904525
In my example:
Create 5 items in the menu the Main one ListItem1 beneath that one 2,3,4 and 5

then use this code:
private void menuItem2_Click(object sender, System.EventArgs e)
{
      CheckUncheck(this.menuItem2);
}

private void menuItem3_Click(object sender, System.EventArgs e)
{
      CheckUncheck(this.menuItem3);
}

private void menuItem4_Click(object sender, System.EventArgs e)
{
      CheckUncheck(this.menuItem4);
}

private void menuItem5_Click(object sender, System.EventArgs e)
{
                 CheckUncheck(this.menuItem5);
}
private void CheckUncheck(MenuItem ClickedItem)
{
      foreach(MenuItem myItem in menuItem1.MenuItems)
      {
            if(myItem.Text != ClickedItem.Text)
            myItem.Checked = false;
            else
            myItem.Checked = true;
      }
}

Take care,

Ed
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question