Solved

Windows Programming - Menus

Posted on 2004-04-22
3
223 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to split this in C++ 4 94
countAbc challenge 9 59
When i run adoquery my application freezes 26 152
C# DataGridView_RowsAdded event not firing 1 66
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
A short article about problems I had with the new location API and permissions in Marshmallow
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

863 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now