locked
How to change (Checked menu items). RRS feed

  • Question

  • I have two menu items from which I choose the interface language of a program (English or French).

    I want either of them to be chosen, both can not be chosen at the same time. I went over the properties of ToolStripMenuItem object and saw three properties that are confusing (Checked, CheckState and CheckOnClick), how can I mix them so that I get that functionality, I mean that when I check the French, the English gets unchecked and vice versa.


    Luai Alrantisi, BSc in Computer Engineering, University of Ottawa 2007, Canada. IT Manager of MTN Mobile Telecom.

    Tuesday, March 27, 2012 10:19 AM

Answers

  • Handle the CheckedChanged event of both menu items. In the English handler, if it gets checked, uncheck the French item. In the French handler, if it gets checked, uncheck the English item.

    An item can be checked, unchecked or in an "inderterminate" state. It's returned/set by the CheckState property. If the item does not make use of the inderterminate state, it's simpler to use the Checked state. CheckOnClick determines if the item is automatically checked if the user selects the item.


    Armin

    • Proposed as answer by Mark Liu-lxf Thursday, March 29, 2012 2:29 AM
    • Marked as answer by Mark Liu-lxf Thursday, April 5, 2012 6:37 AM
    Tuesday, March 27, 2012 10:53 AM